11942 | 2024-11-21 17:16:56 | matekimado11 | Kocsirendező | cpp17 | Wrong answer 0/100 | 32ms | 700 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++)
{
if(autok[i]!=i)sz++;
}
if(sz<=2)cout<<"-1 \n";
else cout<<sz-1<<'\n';
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 1ms | 500 KiB | ||||
2 | Accepted | 1ms | 320 KiB | ||||
subtask2 | 0/30 | ||||||
3 | Wrong answer | 1ms | 380 KiB | ||||
4 | Wrong answer | 1ms | 320 KiB | ||||
5 | Wrong answer | 1ms | 320 KiB | ||||
6 | Accepted | 1ms | 320 KiB | ||||
7 | Wrong answer | 1ms | 320 KiB | ||||
8 | Wrong answer | 1ms | 320 KiB | ||||
9 | Wrong answer | 1ms | 320 KiB | ||||
10 | Wrong answer | 1ms | 320 KiB | ||||
11 | Wrong answer | 1ms | 508 KiB | ||||
12 | Wrong answer | 1ms | 320 KiB | ||||
13 | Wrong answer | 1ms | 320 KiB | ||||
14 | Wrong answer | 1ms | 508 KiB | ||||
15 | Wrong answer | 1ms | 320 KiB | ||||
16 | Wrong answer | 1ms | 320 KiB | ||||
17 | Wrong answer | 1ms | 508 KiB | ||||
18 | Wrong answer | 1ms | 320 KiB | ||||
19 | Wrong answer | 1ms | 320 KiB | ||||
20 | Wrong answer | 1ms | 320 KiB | ||||
21 | Wrong answer | 1ms | 320 KiB | ||||
22 | Wrong answer | 1ms | 320 KiB | ||||
23 | Wrong answer | 1ms | 320 KiB | ||||
24 | Wrong answer | 1ms | 408 KiB | ||||
25 | Wrong answer | 1ms | 384 KiB | ||||
subtask3 | 0/70 | ||||||
26 | Wrong answer | 1ms | 552 KiB | ||||
27 | Wrong answer | 1ms | 320 KiB | ||||
28 | Wrong answer | 1ms | 320 KiB | ||||
29 | Wrong answer | 3ms | 428 KiB | ||||
30 | Wrong answer | 4ms | 424 KiB | ||||
31 | Wrong answer | 8ms | 416 KiB | ||||
32 | Wrong answer | 8ms | 456 KiB | ||||
33 | Wrong answer | 18ms | 432 KiB | ||||
34 | Wrong answer | 30ms | 604 KiB | ||||
35 | Wrong answer | 30ms | 668 KiB | ||||
36 | Wrong answer | 32ms | 700 KiB | ||||
37 | Wrong answer | 32ms | 560 KiB | ||||
38 | Wrong answer | 32ms | 540 KiB | ||||
39 | Wrong answer | 32ms | 620 KiB |