# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
85925 | 2018-11-22T20:07:41 Z | memetkagan44 | Studentsko (COCI14_studentsko) | C++11 | 6 ms | 1956 KB |
#include<bits/stdc++.h> using namespace std; int n,k,ar[5001]; vector<int> ans; vector<pair<int,int> > v; int main(){ scanf("%d %d",&n,&k); for(int i=0;i<n;i++){ scanf("%d",&ar[i]); v.push_back(make_pair(ar[i],i)); } sort(v.begin(),v.end()); for(int i=0;i<n;i++) ar[v[i].second]=(i/k)+1; ans.push_back(-0x3f3f3f3f); for(int i=0;i<n;i++){ vector<int>::iterator it=upper_bound(ans.begin(),ans.end(),ar[i]); if(it==ans.end()) ans.push_back(ar[i]); else *it=ar[i]; } printf("%d\n",n+1-ans.size()); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 552 KB | Output is correct |
2 | Correct | 2 ms | 552 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 608 KB | Output is correct |
2 | Correct | 2 ms | 652 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 1100 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 1100 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 1380 KB | Output is correct |
2 | Correct | 4 ms | 1380 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 1472 KB | Output is correct |
2 | Correct | 4 ms | 1512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 1712 KB | Output is correct |
2 | Correct | 4 ms | 1744 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 1808 KB | Output is correct |
2 | Correct | 4 ms | 1860 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 1908 KB | Output is correct |
2 | Correct | 6 ms | 1956 KB | Output is correct |