Submission #463508

# Submission time Handle Problem Language Result Execution time Memory
463508 2021-08-11T09:25:50 Z Quentolosse Exam (eJOI20_exam) C++14
12 / 100
56 ms 908 KB
//sous-tache 2

#include <iostream>
#include <vector>

using namespace std;

int main ()
{
    int nbCandidats, objectif, entree, total = 0, candidatDansIntervalle = 0, candidatsDansIntervalle = 0;
    vector<int> candidats;
    cin >> nbCandidats;
    for (int i = 0; i < nbCandidats; i++)
    {
        cin >> entree;
        candidats.push_back(entree);
    }
    cin >> objectif;
    for (int i = 0; i < nbCandidats; i++)
    {
        if (candidats[i] == objectif)
        {
            candidatDansIntervalle = 1;
            candidatsDansIntervalle ++;
        }
        else if (candidats[i] < objectif)
        {
            candidatsDansIntervalle ++;
        }
        else
        {
            total += candidatsDansIntervalle * candidatDansIntervalle;
            candidatsDansIntervalle = 0;
            candidatDansIntervalle = 0;
        }
    }
    total += candidatsDansIntervalle * candidatDansIntervalle;
    candidatsDansIntervalle = 0;
    candidatDansIntervalle = 0;
    cout << total;
    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 204 KB Output is correct
2 Correct 10 ms 412 KB Output is correct
3 Correct 29 ms 852 KB Output is correct
4 Correct 22 ms 908 KB Output is correct
5 Correct 56 ms 908 KB Output is correct
6 Correct 19 ms 840 KB Output is correct
7 Correct 21 ms 840 KB Output is correct
8 Correct 46 ms 864 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 3 ms 332 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 -