23792023-01-12 08:44:45TuruTamasRendezéscpp11Wrong answer 11/40118ms4668 KiB
#include <bits/stdc++.h>
using namespace std;

int N, M;

int main() {
    cin >> N >> M;
    vector<int> S(N);
    for (size_t i = 0; i < N; i++)
    {
        cin >> S[i];
    }
    int a, b;
    for (size_t i = 0; i < M; i++)
    {
        cin >> a >> b;
        a--; b--;
        sort(S.begin() + a, S.begin() + b + 1);
    }
    int counter = 0;
    for (size_t i = 0; i < S.size(); i++)
    {
        if (S[i] == i + 1) counter++;
    }
    cout << counter;
}
SubtaskSumTestVerdictTimeMemory
base11/40
1Accepted0/03ms1816 KiB
2Wrong answer0/014ms2076 KiB
3Accepted2/22ms2276 KiB
4Accepted2/22ms2336 KiB
5Wrong answer0/22ms2420 KiB
6Wrong answer0/22ms2516 KiB
7Wrong answer0/23ms2752 KiB
8Wrong answer0/23ms2792 KiB
9Wrong answer0/23ms2948 KiB
10Wrong answer0/23ms3040 KiB
11Wrong answer0/297ms3944 KiB
12Accepted2/298ms3916 KiB
13Accepted2/297ms3916 KiB
14Accepted1/197ms4292 KiB
15Accepted2/297ms4192 KiB
16Wrong answer0/2105ms4420 KiB
17Wrong answer0/2115ms4472 KiB
18Wrong answer0/2112ms4480 KiB
19Wrong answer0/2112ms4472 KiB
20Wrong answer0/1111ms4476 KiB
21Wrong answer0/2118ms4476 KiB
22Wrong answer0/2107ms4600 KiB
23Wrong answer0/2109ms4668 KiB