153802025-02-19 10:14:19feheristvanSzínes szobák (50 pont)cpp17Wrong answer 0/50400ms4888 KiB
#include <iostream>
#include <vector>
#include <unordered_map>

using namespace std;

int main() {
    int N, K, M;
    cin >> N >> K >> M;
    
    vector<int> rooms(N);
    unordered_map<int, vector<int>> color_positions;
    
    for (int i = 0; i < N; i++) {
        cin >> rooms[i];
        color_positions[rooms[i]].push_back(i);
    }
    
    int exited = 0;
    
    for (int i = 0; i < M; i++) {
        int c, x;
        cin >> c >> x;
        
        vector<int> new_positions;
        for (int pos : color_positions[c]) {
            int new_pos = pos + x;
            if (new_pos < 0 || new_pos >= N) {
                exited++;
            } else {
                new_positions.push_back(new_pos);
            }
        }
        
        color_positions[c] = new_positions;
    }
    
    cout << exited << "\n";
    
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/01ms316 KiB
2Wrong answer0/0119ms2604 KiB
3Wrong answer0/13ms316 KiB
4Wrong answer0/13ms316 KiB
5Wrong answer0/12ms316 KiB
6Wrong answer0/12ms316 KiB
7Wrong answer0/12ms444 KiB
8Wrong answer0/12ms420 KiB
9Wrong answer0/12ms316 KiB
10Wrong answer0/14ms492 KiB
11Wrong answer0/12ms508 KiB
12Wrong answer0/16ms316 KiB
13Wrong answer0/143ms640 KiB
14Wrong answer0/116ms564 KiB
15Wrong answer0/118ms808 KiB
16Wrong answer0/164ms868 KiB
17Wrong answer0/181ms820 KiB
18Wrong answer0/179ms864 KiB
19Wrong answer0/172ms2356 KiB
20Wrong answer0/1119ms2492 KiB
21Wrong answer0/189ms2504 KiB
22Wrong answer0/196ms2356 KiB
23Wrong answer0/1111ms2356 KiB
24Wrong answer0/1119ms2364 KiB
25Wrong answer0/1118ms2292 KiB
26Wrong answer0/1118ms2428 KiB
27Time limit exceeded0/3384ms4880 KiB
28Time limit exceeded0/3386ms4888 KiB
29Time limit exceeded0/3400ms4876 KiB
30Time limit exceeded0/3400ms4872 KiB
31Time limit exceeded0/3379ms4888 KiB
32Time limit exceeded0/3384ms4880 KiB
33Time limit exceeded0/4398ms2688 KiB
34Time limit exceeded0/4398ms2696 KiB