119482024-11-21 20:57:50lalalaKocsirendezőcpp17Wrong answer 0/10034ms792 KiB
#include<iostream>
using namespace std;
int main()
{
    int n,sz=0;
    cin>>n;
    n++;
    int autok[n];
    for(int i=1;i<n;i++)
    {
        cin>>autok[i];
    }
    for(int i=1;i<n;i++)
    {
        while(autok[i]!=i)
        {
            swap(autok[i],autok[autok[i]]);
            sz++;
        }
    }
    if(sz<2)cout<<"-1 \n";
    else cout<<sz<<'\n';
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted1ms320 KiB
2Accepted1ms320 KiB
subtask20/30
3Wrong answer1ms500 KiB
4Wrong answer1ms320 KiB
5Wrong answer1ms508 KiB
6Accepted1ms320 KiB
7Wrong answer1ms320 KiB
8Wrong answer1ms320 KiB
9Accepted1ms320 KiB
10Wrong answer1ms320 KiB
11Wrong answer1ms320 KiB
12Wrong answer1ms324 KiB
13Wrong answer1ms320 KiB
14Wrong answer1ms508 KiB
15Wrong answer1ms320 KiB
16Wrong answer1ms356 KiB
17Wrong answer1ms320 KiB
18Wrong answer1ms320 KiB
19Wrong answer1ms320 KiB
20Wrong answer1ms320 KiB
21Wrong answer1ms320 KiB
22Wrong answer1ms320 KiB
23Wrong answer1ms320 KiB
24Wrong answer1ms320 KiB
25Wrong answer1ms508 KiB
subtask30/70
26Wrong answer1ms320 KiB
27Wrong answer1ms320 KiB
28Wrong answer2ms408 KiB
29Wrong answer3ms320 KiB
30Wrong answer4ms452 KiB
31Wrong answer8ms320 KiB
32Wrong answer8ms420 KiB
33Wrong answer18ms568 KiB
34Wrong answer30ms576 KiB
35Wrong answer30ms568 KiB
36Wrong answer30ms636 KiB
37Wrong answer32ms740 KiB
38Wrong answer34ms792 KiB
39Wrong answer34ms776 KiB