44202023-03-27 18:59:39balaaaazsElőzésekcpp14Wrong answer 0/100527ms7032 KiB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int n, q;
    cin >> n >> q;

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

    vector<int> freq(n, 0);
    int max_freq = 0;
    int max_freq_car = c[0];

    for (int i = 0; i < q; i++) {
        int car;
        cin >> car;

        freq[car-1]++;
        if (freq[car-1] > max_freq || (freq[car-1] == max_freq && car < max_freq_car)) {
            max_freq = freq[car-1];
            max_freq_car = car;
        }

        cout << max_freq_car << endl;
    }

    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer3ms1812 KiB
subtask20/30
2Wrong answer3ms2052 KiB
3Wrong answer3ms2300 KiB
4Wrong answer4ms2564 KiB
5Wrong answer4ms2760 KiB
6Wrong answer6ms2812 KiB
7Wrong answer8ms2976 KiB
subtask30/70
8Wrong answer254ms3672 KiB
9Wrong answer344ms4352 KiB
10Wrong answer421ms4776 KiB
11Wrong answer273ms5644 KiB
12Wrong answer210ms5752 KiB
13Wrong answer275ms6244 KiB
14Wrong answer428ms6660 KiB
15Wrong answer338ms6836 KiB
16Wrong answer337ms6836 KiB
17Wrong answer527ms6896 KiB
18Wrong answer377ms7032 KiB
19Wrong answer202ms6920 KiB
20Wrong answer377ms6792 KiB
21Wrong answer527ms6908 KiB