Submission #861009

# Submission time Handle Problem Language Result Execution time Memory
861009 2023-10-15T06:29:26 Z rati Poklon (COCI17_poklon) C++14
0 / 140
5000 ms 4716 KB
#include <iostream>
#include <vector>
#include <unordered_map>
#include <set>

using namespace std;

int main() {
    int N, Q;
    cin >> N >> Q;

    vector<int> array(N);
    for (int i = 0; i < N; i++) {
        cin >> array[i];
    }

    unordered_map<int, int> count;
    for (int num : array) {
        count[num]++;
    }

    for (int q = 0; q < Q; q++) {
        int L, R;
        cin >> L >> R;

        set<int> unique_twice;
        for (int i = L - 1; i < R; i++) {
            if (count[array[i]] == 2) {
                unique_twice.insert(array[i]);
            }
        }

        cout << unique_twice.size() << endl;
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Incorrect 2 ms 348 KB Output isn't correct
3 Incorrect 3 ms 348 KB Output isn't correct
4 Incorrect 45 ms 344 KB Output isn't correct
5 Execution timed out 5087 ms 1764 KB Time limit exceeded
6 Execution timed out 5036 ms 2024 KB Time limit exceeded
7 Execution timed out 5012 ms 2916 KB Time limit exceeded
8 Execution timed out 5048 ms 3400 KB Time limit exceeded
9 Execution timed out 5061 ms 3824 KB Time limit exceeded
10 Execution timed out 5045 ms 4716 KB Time limit exceeded