Submission #441472

# Submission time Handle Problem Language Result Execution time Memory
441472 2021-07-05T08:30:24 Z elazarkoren Exam (eJOI20_exam) C++17
12 / 100
47 ms 1408 KB
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#define x first
#define y second
//#define int long long
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vii;

const int MAX_N = 1e5 + 1;

int a[MAX_N];

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    int b;
    cin >> b;
    bool good = false;
    int count = 0;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] > b) {
            ans += (good ? count : 0);
            count = 0;
            good = false;
        } else {
            count++;
            if (a[i] == b) good = true;
        }
    }
    ans += (good ? count : 0);
    cout << ans;
}
# 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 Correct 10 ms 716 KB Output is correct
3 Correct 31 ms 1308 KB Output is correct
4 Correct 19 ms 1036 KB Output is correct
5 Correct 47 ms 1408 KB Output is correct
6 Correct 19 ms 972 KB Output is correct
7 Correct 21 ms 1092 KB Output is correct
8 Correct 46 ms 1340 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 3 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 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 -