65772023-12-12 13:09:35batyuElőzésekcpp17Wrong answer 0/1003.088s7100 KiB
// Előzések.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
int find(int val, std::vector<int> vec)
{
    int i = 0;
    while (i < vec.size() && val != vec[i])
        i++;
    return i == vec.size() ? -1 : i;
}
int main()
{
    int N, Q;
    std::vector<int> sorrend;
    std::vector<int> elozesrend;
    std::cin >> N >> Q;
    int* elozesek = new int[N];
    
    for (int i = 0; i < N; i++)
    {
        int temp;
        std::cin >> temp;
        sorrend.push_back(temp);
        elozesek[i] = 0;
    }
    for (int i = 0; i < Q; i++)
    {
        int temp;
        std::cin >> temp;
        elozesrend.push_back(temp);
    }
    int maxi = elozesek[0];
    for (int i = 0; i < Q; i++)
    {
        //megelozi
        int ind = find(elozesrend[i], sorrend);
        int temp = sorrend[ind];
        sorrend[ind] = sorrend[ind - 1];
        sorrend[ind - 1] = temp;
        elozesek[sorrend[ind]]++;
        //valasz
        std::cout << maxi << std::endl;
    }

}

SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer3ms1808 KiB
subtask20/30
2Wrong answer3ms2056 KiB
3Wrong answer3ms2216 KiB
4Wrong answer4ms2320 KiB
5Wrong answer4ms2456 KiB
6Wrong answer8ms2672 KiB
7Wrong answer8ms3016 KiB
subtask30/70
8Wrong answer1.559s4700 KiB
9Time limit exceeded3.053s3768 KiB
10Time limit exceeded3.042s4476 KiB
11Time limit exceeded3.079s4836 KiB
12Time limit exceeded3.062s4968 KiB
13Time limit exceeded3.071s5916 KiB
14Time limit exceeded3.079s6216 KiB
15Time limit exceeded3.088s6492 KiB
16Time limit exceeded3.059s6344 KiB
17Time limit exceeded3.072s6388 KiB
18Time limit exceeded3.079s6820 KiB
19Time limit exceeded3.059s7080 KiB
20Time limit exceeded3.059s6968 KiB
21Time limit exceeded3.071s7100 KiB