94692024-02-22 09:26:13TortelliniJrSzínes szobák (50 pont)cpp17Accepted 50/5032ms6116 KiB
#include <iostream>
#include <vector>
#include <array>
using namespace std;
// literally fully "loaned" code from njudge, i am far too stupid for this shit
int main()
{
    cin.tie(0), cin.sync_with_stdio(0);
    int szob, szin, ut;
    cin >> szob >> szin >> ut;
    vector<int> hell(szob + 2);
    for (int i = 1; i <= szob; i++)
    {
        cin >> hell[i];
    }
    vector<array<int, 2>> uts(ut);
    for (int i = ut - 1; i >= 0; i--)
        cin >> uts[i][0] >> uts[i][1];
    int r = szob + 1;
    int l = 0;
    for (int i = 0; i < uts.size(); i++) {
        int c = uts[i][0];
        int x = uts[i][1];
        if (x == -1 && c == hell[l + 1]) { l++; };
        if (x == 1 && c == hell[l]) { l--; };
        if (x == 1 && c == hell[r - 1]) { r--; };
        if (x == -1 && c == hell[r]) { r++; };
    }
    cout << (l - r + szob + 1);
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1832 KiB
2Accepted0/032ms4440 KiB
3Accepted1/13ms2516 KiB
4Accepted1/13ms2460 KiB
5Accepted1/13ms2948 KiB
6Accepted1/13ms2704 KiB
7Accepted1/13ms2708 KiB
8Accepted1/13ms2700 KiB
9Accepted1/13ms2768 KiB
10Accepted1/13ms3036 KiB
11Accepted1/13ms3256 KiB
12Accepted1/13ms3328 KiB
13Accepted1/14ms3556 KiB
14Accepted1/14ms3360 KiB
15Accepted1/14ms3364 KiB
16Accepted1/14ms3412 KiB
17Accepted1/14ms3556 KiB
18Accepted1/14ms3560 KiB
19Accepted1/119ms4584 KiB
20Accepted1/132ms5776 KiB
21Accepted1/124ms5184 KiB
22Accepted1/126ms5104 KiB
23Accepted1/129ms5272 KiB
24Accepted1/132ms5632 KiB
25Accepted1/132ms5636 KiB
26Accepted1/132ms5944 KiB
27Accepted3/330ms5844 KiB
28Accepted3/329ms5904 KiB
29Accepted3/329ms6104 KiB
30Accepted3/329ms6064 KiB
31Accepted3/329ms6116 KiB
32Accepted3/330ms6060 KiB
33Accepted4/416ms4624 KiB
34Accepted4/426ms5540 KiB