Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <vector>
- using namespace std;
- ifstream ifs("input.txt");
- ofstream ofs("output.txt");
- int a[10000000];
- int t[10000000];
- int f(int n){
- int max=0;
- t[0]=1;
- for(int i=1;i<n;i++){
- int m=0;
- for(int j=0;j<i;j++){
- if(a[i]>a[j]&&t[j]>m){
- t[i]=t[j]+1;
- m=t[j];
- };
- if(!t[i])t[i]++;
- if(t[i]>max)max=t[i];
- };
- };
- return max;
- };
- int main()
- {
- int n,k,max,h=0;
- ifs>>n>>k;
- int t;
- for(int i=0;i<n;i++){
- ifs>>t;
- for(int j=0;j<k;j++)a[(n*(j+1)-i-1)*(j%2)+(n*j+i)*((j+1)%2)]=t;
- };
- ofs<<f(k*n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement