Submission #541841

# Submission time Handle Problem Language Result Execution time Memory
541841 2022-03-24T14:21:44 Z Olympia Baloni (COCI15_baloni) C++17
100 / 100
1919 ms 7252 KB
#include <vector>
#include <algorithm>
#include <iostream>
#include <set>
#include <cmath>
#include <map>
#include <random>
#include <cassert>
#include <ctime>
#include <cstdlib>
#include <limits.h>

using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    cin >> N;
    vector<int64_t> v(N); for (int i = 0; i < N; i++) cin >> v[i];
    int sm = 0;
    for (int i = 0; i < N; i++) {
        if (v[i] == 0) {
            continue;
        }
        int cntr = 1;
        for (int j = i + 1; j < N; j++) {
            if (v[j] == v[i] - cntr) {
                cntr++;
                v[j] = 0;
            }
        }
        v[i] = 0;
        sm++;
    }
    cout << sm;

}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Correct 4 ms 340 KB Output is correct
4 Correct 8 ms 340 KB Output is correct
5 Correct 787 ms 6484 KB Output is correct
6 Correct 1919 ms 7252 KB Output is correct
7 Correct 1863 ms 5972 KB Output is correct
8 Correct 1543 ms 5972 KB Output is correct
9 Correct 1132 ms 6228 KB Output is correct
10 Correct 1641 ms 6484 KB Output is correct