8422022-01-20 12:49:43Halasz EszterRendezéscpp11Wrong answer 11/40104ms17648 KiB
#include <iostream>
//#include <fstream>
#include <vector>
#include <algorithm>

using namespace std;

//ifstream cin("rendezes.in");
//ofstream cout("rendezes.out");

vector<int>x,v;

struct adat
{
    int a,b;

};
vector<adat>y;


int n,m,i,a,b,db;


int main()
{
    cin>>n>>m;
    x.resize(n+1);
    for(i=1;i<=n;++i)
        cin>>x[i];

    y.resize(m+1);
    v.resize(n+1);
    for(i=1;i<=m;++i)
        cin>>y[i].a>>y[i].b;

    while(v!=x)
    {
        for(i=1;i<=m;++i)  sort(x.begin()+y[i].a,x.begin()+y[i].b+1);
        if(v==x) break;
        else v=x;

    }


    for(i=1;i<=n;++i)
        if(x[i]==i) db++;
    cout<<db;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base11/40
1Accepted0/02ms1800 KiB
2Wrong answer0/013ms2408 KiB
3Accepted2/21ms2116 KiB
4Accepted2/21ms2136 KiB
5Wrong answer0/21ms2132 KiB
6Wrong answer0/21ms2136 KiB
7Wrong answer0/22ms2180 KiB
8Wrong answer0/22ms2176 KiB
9Wrong answer0/22ms2196 KiB
10Wrong answer0/22ms2216 KiB
11Wrong answer0/286ms6904 KiB
12Accepted2/2104ms8628 KiB
13Accepted2/283ms10360 KiB
14Accepted1/187ms12100 KiB
15Accepted2/296ms13828 KiB
16Wrong answer0/2100ms15564 KiB
17Wrong answer0/297ms17288 KiB
18Wrong answer0/298ms17632 KiB
19Wrong answer0/2101ms17648 KiB
20Wrong answer0/197ms17640 KiB
21Wrong answer0/2103ms17644 KiB
22Wrong answer0/292ms17632 KiB
23Wrong answer0/296ms17596 KiB