# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
463492 | kilikuma | Exam (eJOI20_exam) | C++14 | 16 ms | 1316 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main() {
int nbEleves; scanf("%d",&nbEleves);
int A[100000+42];
for (int i = 1; i<= nbEleves; i++) {
scanf("%d",&A[i]);
}
vector<int> obstacles;
obstacles.push_back(0);
int objectif;
scanf("%d",&objectif);
for (int i=1;i<=nbEleves; i++) {
if (A[i] > objectif) {
obstacles.push_back(i);
}
}
obstacles.push_back(nbEleves+1);
int maxi = 0;
for (int i=0;i<obstacles.size()-1;i++) {
bool cond =false;
for (int a = obstacles[i]+1; a < obstacles[i+1]; a ++) {
if (A[a] == objectif) cond = true;
}
if (cond ){
maxi += (obstacles[i+1]-obstacles[i]-1);
}
}
cout << maxi << endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |