# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
465677 |
2021-08-16T16:16:00 Z |
Alen777 |
Exam (eJOI20_exam) |
C++14 |
|
29 ms |
3800 KB |
#include <iostream>
#include <string>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <algorithm>
#include <cstring>
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb push_back
#define mpr make_pair
#define lb lower_bound
#define ld long double
#define ub upper_bound
ll a[200005], b[200005];
int n;
void solve() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i < n; i++) {
cin >> b[i];
}
ll ans = 0, num = 0;
ll s = 0;
bool flag = false;
for (int i = 0; i < n; i++) {
if (a[i] < b[0]) {
if (flag) {
num++;
}
s++;
}
else if (a[i] == b[0]) {
num = s+1;
s++;
flag = true;
}
else {
ans += num;
num = 0, s = 0;
flag = false;
}
}
cout << ans + num << endl;
}
int main() {
/*cout.setf(ios::fixed | ios::showpoint);
cout.precision(6);*/
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int t = 1;
//cin >> t;
while (t--) {
solve();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
6 ms |
972 KB |
Output is correct |
3 |
Correct |
18 ms |
2712 KB |
Output is correct |
4 |
Correct |
16 ms |
2248 KB |
Output is correct |
5 |
Correct |
29 ms |
3800 KB |
Output is correct |
6 |
Correct |
16 ms |
2252 KB |
Output is correct |
7 |
Correct |
17 ms |
2332 KB |
Output is correct |
8 |
Correct |
27 ms |
3772 KB |
Output is correct |
# |
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 |
2 ms |
460 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 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |