# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
842151 | 2023-09-02T12:51:46 Z | konber | Exam (eJOI20_exam) | C++14 | 1 ms | 756 KB |
#include <iostream> #include <vector> using namespace std; vector<int> A, b; int N; int f(vector<int> a, int i){ if(i==N){ int ans=0; for(int j=0; j < N; j++) ans += a[j]==b[j]; return ans; } int j=i, k=i; bool changes=true; vector<int> a1=a, a2=a; while(changes){ changes = false; if(j >= 0 && a[j] <= b[i]){ a1[j] = b[i]; changes=true; j--; } if(k <= N-1 && a[k] <= b[i]){ a2[k] = b[i]; changes=true; k++; } if(j==0 && k==N-1) break; } return max(f(a, i+1), max(f(a1, i+1), f(a2, i+1))); } int main() { scanf("%d", &N); A.resize(N); b.resize(N); for(int i=0; i < N; i++) scanf("%d", &A[i]); for(int i=0; i < N; i++) scanf("%d", &b[i]); if(N <= 10){ cout << f(A, 0) << endl; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Incorrect | 1 ms | 436 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 756 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Incorrect | 1 ms | 436 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Incorrect | 1 ms | 436 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |