119412024-11-21 17:14:29matekimado11Kocsirendezőcpp17Wrong answer 0/10035ms1336 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 answer1ms320 KiB
4Wrong answer1ms320 KiB
5Wrong answer1ms320 KiB
6Accepted1ms348 KiB
7Wrong answer1ms320 KiB
8Wrong answer1ms388 KiB
9Accepted1ms568 KiB
10Wrong answer1ms500 KiB
11Wrong answer1ms320 KiB
12Wrong answer1ms320 KiB
13Wrong answer1ms320 KiB
14Wrong answer1ms320 KiB
15Wrong answer1ms320 KiB
16Wrong answer1ms408 KiB
17Wrong answer1ms320 KiB
18Wrong answer1ms332 KiB
19Wrong answer1ms320 KiB
20Wrong answer1ms320 KiB
21Wrong answer1ms320 KiB
22Wrong answer1ms648 KiB
23Wrong answer1ms512 KiB
24Wrong answer1ms320 KiB
25Wrong answer1ms332 KiB
subtask30/70
26Wrong answer1ms320 KiB
27Wrong answer1ms508 KiB
28Wrong answer2ms320 KiB
29Wrong answer3ms420 KiB
30Wrong answer4ms320 KiB
31Wrong answer8ms568 KiB
32Wrong answer8ms540 KiB
33Wrong answer18ms840 KiB
34Wrong answer32ms1088 KiB
35Wrong answer30ms1204 KiB
36Wrong answer32ms1208 KiB
37Wrong answer32ms1216 KiB
38Wrong answer35ms1336 KiB
39Wrong answer35ms1188 KiB