23772023-01-12 08:18:38sztomiRendezéscpp11Wrong answer 11/4052ms5144 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int n, m;
    cin >> n >> m;
    vector<int> szamok(n);
    for(int i = 0; i < n; i++){
        cin >> szamok[i];
    }
    int a, b;
    for(int i = 0; i < m; i++){
        cin >> a >> b;
        a--;
        sort(szamok.begin()+a, szamok.begin()+b);
    }
    int db = 0;
    for(int i = 0; i < n; i++){
        db += (szamok[i] == i+1);
    }
    cout << db << "\n";
}
SubtaskSumTestVerdictTimeMemory
base11/40
1Accepted0/03ms1828 KiB
2Wrong answer0/07ms2080 KiB
3Accepted2/22ms2260 KiB
4Accepted2/22ms2444 KiB
5Wrong answer0/22ms2652 KiB
6Wrong answer0/22ms2856 KiB
7Wrong answer0/22ms2944 KiB
8Wrong answer0/22ms3048 KiB
9Wrong answer0/22ms3124 KiB
10Wrong answer0/22ms3120 KiB
11Wrong answer0/230ms3804 KiB
12Accepted2/230ms3928 KiB
13Accepted2/230ms4028 KiB
14Accepted1/130ms4244 KiB
15Accepted2/230ms4308 KiB
16Wrong answer0/239ms4472 KiB
17Wrong answer0/248ms4652 KiB
18Wrong answer0/246ms4852 KiB
19Wrong answer0/245ms5088 KiB
20Wrong answer0/143ms5020 KiB
21Wrong answer0/252ms5012 KiB
22Wrong answer0/239ms5144 KiB
23Wrong answer0/243ms5112 KiB