# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
469664 |
2021-09-01T14:43:02 Z |
Itamar |
Exam (eJOI20_exam) |
C++14 |
|
68 ms |
2356 KB |
#include <vector>
#include <algorithm>
using namespace std;
#include <iostream>
vector<int> pre;
int n;
/*int lower_bo(int l, int r, int val) {
int mid = (l + r) / 2;
if (pre[mid] < val && (mid == n || pre[mid+1] >= val) ) {
return mid+1;
}
if (pre[mid] < val) {
return lower_bo(mid + 1, r, val);
}
if (pre[mid] > val) {
return lower_bo(l, mid - 1, val);
}
}*/
int main()
{
int n;
cin >> n;
vector<int> r;
vector<int> m;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
m.push_back(x);
}
for (int i = 0; i < n; i++) {
int x;
cin >> x;
//for (int j = i; j < n; j++) {
//if (x == m[j]) {
r.push_back(x);
// break;
//}
//}
}
int cur = -1;
bool is = false;
int sum = 0;
for (int i = 0; i < n; i++) {
if (m[i] == r[0]) {
is = true;
}
if (i == n - 1) {
if (is) {
sum += i - cur - 1;
}
if (m[i] <= r[0]) {
sum++;
}
}
else {
if (m[i] > r[0]) {
if (is) {
sum += i - cur - 1;
}
cur = i;
is = 0;
}
}
}
cout << sum;
/*int siz = r.size();
vector<int>max(siz, -1);
for (int i = 0; i < siz; i++) {
for (int j = 0; j < siz; j++) {
if (max[j] <= r[i] && max[j] != -1) {
if (max[j + 1] > r[i] || max[j + 1] == -1) {
max[j + 1] = r[i];
break;
}
}
}
if (max[0] > r[i] || max[0] == -1) {
max[0] = r[i];
}
}
for (int i = siz-1; i >= 0; i--) {
if (max[i] != -1) {
cout << i+1;
break;
}
}
if (siz == 0) {
cout << 0;
}*/
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 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 |
Correct |
19 ms |
508 KB |
Output is correct |
3 |
Correct |
68 ms |
2356 KB |
Output is correct |
4 |
Incorrect |
39 ms |
1708 KB |
Output isn't correct |
5 |
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 |
6 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 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |