9002022-01-26 12:41:59kicsiboglarRendezéscpp11Wrong answer 2/4065ms25964 KiB
#include <iostream>
#include <vector>
#include <algorithm>
#define ll long long 

using namespace std;

ll n, m, i, j,a,b;

int main()
{
    ios::sync_with_stdio(false);
    cin >> n >> m;
    vector <ll> x(n + 1);
    for (i = 1; i <=n; ++i) cin >> x[i];

    for (i = 1; i <= m; ++i)
    {
        cin >> a >> b;
        sort(x.begin() + a, x.begin() + b+1);

    }
    ll db = 0;
    for (i = 0; i < n; ++i) if (x[i] == i) db++;
    cout << db;
}

SubtaskSumTestVerdictTimeMemory
base2/40
1Accepted0/02ms1756 KiB
2Wrong answer0/06ms2096 KiB
3Wrong answer0/21ms2068 KiB
4Accepted2/21ms2072 KiB
5Wrong answer0/21ms2072 KiB
6Wrong answer0/21ms2080 KiB
7Wrong answer0/21ms2096 KiB
8Wrong answer0/21ms2116 KiB
9Wrong answer0/21ms2128 KiB
10Wrong answer0/21ms2140 KiB
11Wrong answer0/230ms5164 KiB
12Wrong answer0/235ms6896 KiB
13Wrong answer0/237ms8632 KiB
14Wrong answer0/132ms10416 KiB
15Wrong answer0/232ms12136 KiB
16Wrong answer0/241ms13836 KiB
17Wrong answer0/246ms15604 KiB
18Wrong answer0/257ms17300 KiB
19Wrong answer0/265ms19032 KiB
20Wrong answer0/148ms20764 KiB
21Wrong answer0/252ms22496 KiB
22Wrong answer0/243ms24264 KiB
23Wrong answer0/241ms25964 KiB