# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
467312 |
2021-08-22T13:33:45 Z |
syrtin |
Exam (eJOI20_exam) |
C++17 |
|
29 ms |
2388 KB |
/*author: syrtin*/
#include <bits/stdc++.h>
#define pb push_back
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
using namespace std;
typedef long long ll;
typedef pair<long long, long long> pll;
typedef pair < int, int > pii;
typedef vector<int> vi;
typedef vector<long long> vll;
const int N = 2e5 + 1;
const ll MOD = 1e9 + 7;
const int inf = int(1e9);
const ll INF = ll(1e16);
void SOLVE(/*WATLE*/) {
int n;
cin >> n;
int a[n], b[n];
for(int i = 0; i < n; i++) {
cin >> a[i];
}
for(int i = 0; i < n; i++) {
cin >> b[i];
}
for(int i = 0; i < n; i++) {
if(b[i] == a[i]) {
int j = i - 1;
while(j >= 0 && a[j] < a[i])a[j--] = a[i];
j = i + 1;
while(j < n && a[j] < a[i])a[j++] = a[i];
}
}
int ans = 0;
for(int i = 0; i < n; i++) if(a[i] == b[i])ans++;
cout << ans;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int times = 1;
//cin >> times;
for(int i = 1; i <= times; i++) {
//cout << "Case #" << t << ": ";
SOLVE();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
6 ms |
460 KB |
Output is correct |
3 |
Correct |
18 ms |
1996 KB |
Output is correct |
4 |
Correct |
16 ms |
1480 KB |
Output is correct |
5 |
Correct |
29 ms |
2372 KB |
Output is correct |
6 |
Correct |
18 ms |
1456 KB |
Output is correct |
7 |
Correct |
16 ms |
1588 KB |
Output is correct |
8 |
Correct |
26 ms |
2388 KB |
Output is correct |
# |
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 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |