20592022-12-16 08:05:51kohumarkRendezéscpp11Wrong answer 11/40151ms4796 KiB
#include <bits/stdc++.h>
using namespace std;

int main(){
    int n, m;
    cin >> n >> m;
    int s[n]; int m1, m2;
    for(int i=0; i<n; i++) cin >> s[i];
    for(int i=0; i<m; i++){
        cin >> m1 >> m2;
        for(int i=m1-1; i<m2; i++){
            for(int j=i; j<m2; j++) if(s[i]>s[j]){
                int x = s[j];
                s[j] = s[i];
                s[i] = x;
            }
        }
    }
    int j=0;
    for(int i=0; i<n; i++) if(s[i]==i+1) j++;
    cout << j;
}
SubtaskSumTestVerdictTimeMemory
base11/40
1Accepted0/03ms1876 KiB
2Wrong answer0/014ms2136 KiB
3Accepted2/22ms2328 KiB
4Accepted2/22ms2412 KiB
5Wrong answer0/22ms2608 KiB
6Wrong answer0/22ms2812 KiB
7Wrong answer0/23ms3016 KiB
8Wrong answer0/23ms3224 KiB
9Wrong answer0/23ms3424 KiB
10Wrong answer0/23ms3632 KiB
11Wrong answer0/297ms4648 KiB
12Accepted2/297ms4728 KiB
13Accepted2/297ms4680 KiB
14Accepted1/197ms4684 KiB
15Accepted2/297ms4684 KiB
16Wrong answer0/2115ms4684 KiB
17Wrong answer0/2138ms4680 KiB
18Wrong answer0/2133ms4684 KiB
19Wrong answer0/2131ms4684 KiB
20Wrong answer0/1127ms4680 KiB
21Wrong answer0/2151ms4796 KiB
22Wrong answer0/2116ms4756 KiB
23Wrong answer0/2126ms4760 KiB