Submission #897655
Source Code Expand
#include <stdio.h> int main (void){ int N; scanf("%d",&N); int a[N]; int result = 0; for(int i = 0; i < N; i++){ scanf("%d",&a[i]); } for(int i = 0; i < N; i++){ int tmp = a[i] - 1; if(a[i] != i+1 && i == a[tmp]-1){ if(i == N-1 && tmp == 0){ continue; } else { printf("i:%d, tmp:%d\n",i,tmp); result++; } } } printf("%d\n",result); return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Friendly Rabbits |
User | Scotch |
Language | C (GCC 5.4.1) |
Score | 0 |
Code Size | 408 Byte |
Status | WA |
Exec Time | 29 ms |
Memory | 2432 KB |
Compile Error
./Main.c: In function ‘main’: ./Main.c:5:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&N); ^ ./Main.c:9:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&a[i]); ^
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 200 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_00.txt, 0_01.txt, 0_02.txt |
All | 0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_00.txt | WA | 1 ms | 128 KB |
0_01.txt | AC | 1 ms | 128 KB |
0_02.txt | WA | 1 ms | 128 KB |
1_00.txt | WA | 1 ms | 128 KB |
1_01.txt | WA | 29 ms | 2432 KB |
1_02.txt | AC | 12 ms | 512 KB |
1_03.txt | WA | 14 ms | 768 KB |
1_04.txt | WA | 12 ms | 512 KB |
1_05.txt | WA | 12 ms | 512 KB |
1_06.txt | WA | 12 ms | 512 KB |
1_07.txt | AC | 12 ms | 512 KB |
1_08.txt | WA | 5 ms | 256 KB |
1_09.txt | AC | 10 ms | 512 KB |
1_10.txt | AC | 9 ms | 384 KB |
1_11.txt | WA | 3 ms | 256 KB |