# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
440753 |
2021-07-02T22:46:17 Z |
MrDeboo |
Exam (eJOI20_exam) |
C++17 |
|
1000 ms |
1732 KB |
#include <bits/stdc++.h>
#define int long long
#define mod 1000000007
#define endl '\n'
using namespace std;
signed main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n;
cin>>n;
pair<int,int>pr[n];
for(int i=0;i<n;i++){
cin>>pr[i].first;
}
for(int i=0;i<n;i++){
cin>>pr[i].second;
}
bool bl[n];
memset(bl,false,sizeof(bl));
for(int i=0;i<n;i++){
int a=0,b=0,z=-1;
for(int w=i;w<n&&pr[w].first<=pr[i].first;w++){
if(pr[w].second==pr[i].first)a++;
if(bl[w])b++;
if(a>=b){z=w;}
}
for(int w=i;w<=z;w++){
if(pr[w].second==pr[i].first)bl[w]=true;
else bl[w]=false;
}
a=0;b=0;z=n;
for(int w=i;w>=0&&pr[w].first<=pr[i].first;w--){
if(pr[w].second==pr[i].first)a++;
if(bl[w])b++;
if(a>=b){z=w;}
}
for(int w=i;w>=z;w--){
if(pr[w].second==pr[i].first)bl[w]=true;
else bl[w]=false;
}
}
int ans=0;
for(int i=0;i<n;i++)if(bl[i])ans++;
cout<<ans;
}
//5 1 1 1 6 5
//5 5 6 5 6
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
126 ms |
624 KB |
Output is correct |
3 |
Execution timed out |
1083 ms |
1732 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |