# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1000385 | 2024-06-17T11:01:03 Z | vjudge1 | Exam (eJOI20_exam) | C++17 | 58 ms | 3272 KB |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; vector<int> vec1,vec2; for(int n1=n;n1>0;n1--) { int x; cin>>x; vec1.push_back(x); } for(int n1=n;n1>0;n1--) { int x; cin>>x; vec2.push_back(x); } if(n<=10) { int br=0; int ress=0; for(;br<1<<n;br++) { bool b[vec1.size()]={false}; for(int i=0,br2=br;i<vec1.size();i++,br2=br2>>1) { if(br2&1==1) { b[i]=true; } } int res=0; for(int i=0;i<vec1.size();i++) { if(b[i]==true) { int maxx=vec1[i]; int j=i+1; for(;j<vec1.size() && b[j]==true;j++) { maxx=max(maxx,vec1[j]); } j--; for(int k=i;k<=j;k++) { if(vec2[k]==maxx) res++; } i=j; } else { if(vec1[i]==vec2[i]) res++; } } ress=max(ress,res); } cout<<ress; } else { int maxx=0,lastt=0,res=0; for(int i=0;i<vec1.size();i++) { maxx=max(maxx,vec1[i]); if(maxx>vec2[i]) { maxx=0; lastt=i+1; continue; } if(maxx==vec2[i]) { res=res+i-lastt+1; lastt=i+1; } } cout<<res; } return 0; }
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 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Incorrect | 0 ms | 348 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 10 ms | 936 KB | Output is correct |
3 | Correct | 29 ms | 2464 KB | Output is correct |
4 | Correct | 18 ms | 2000 KB | Output is correct |
5 | Correct | 58 ms | 3272 KB | Output is correct |
6 | Correct | 18 ms | 1740 KB | Output is correct |
7 | Correct | 22 ms | 2004 KB | Output is correct |
8 | Correct | 50 ms | 3272 KB | Output is correct |
# | 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 | 3 ms | 348 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 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Incorrect | 0 ms | 348 KB | Output isn't correct |
6 | 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 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Incorrect | 0 ms | 348 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |