20652022-12-16 08:56:16kohumarkRendezéscpp11Wrong answer 9/4074ms7236 KiB
#include <bits/stdc++.h>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    unsigned int n, m;
    cin >> n >> m;
    int r[m][2];
    int s[n]; bool ok=true;
    for(int i=0; i<n; i++) cin >> s[i];
    for(int i=0; i<m; i++) cin >> r[i][0] >> r[i][1]; int e[n];
    for(int l=0; l<2; l++){
        for(int i=0; i<n; i++) e[i]=s[i];
        for(int i=0; i<m; i++) sort(s+(r[i][0]-1), s+(r[i][1]));
//        for(int i=0; i<n; i++) if(e[i]!=s[i]) ok=true;
    }
    int j=0;
    for(int i=0; i<n; i++) if(s[i]==i+1) j++;
    cout << j;
}
SubtaskSumTestVerdictTimeMemory
base9/40
1Accepted0/03ms1888 KiB
2Wrong answer0/07ms2576 KiB
3Accepted2/22ms2328 KiB
4Wrong answer0/22ms2400 KiB
5Wrong answer0/22ms2532 KiB
6Wrong answer0/22ms2696 KiB
7Wrong answer0/22ms2940 KiB
8Wrong answer0/22ms3000 KiB
9Wrong answer0/22ms2996 KiB
10Wrong answer0/22ms3224 KiB
11Wrong answer0/234ms6376 KiB
12Accepted2/232ms6500 KiB
13Accepted2/234ms6596 KiB
14Accepted1/134ms6944 KiB
15Accepted2/234ms7044 KiB
16Wrong answer0/248ms7236 KiB
17Wrong answer0/265ms7084 KiB
18Wrong answer0/261ms6968 KiB
19Wrong answer0/261ms6972 KiB
20Wrong answer0/157ms7176 KiB
21Wrong answer0/274ms7040 KiB
22Wrong answer0/250ms7012 KiB
23Wrong answer0/257ms7012 KiB