Submission #891384
Source Code Expand
#include <bits/stdc++.h> using namespace std; #define PI 4*atan(1) #define INF 1e8 int dx[4] = {1,0,-1,0}; int dy[4] = {0,1,0,-1}; int main(){ int N; cin >> N; vector<int> a(N), tmp(N, -1); for(int i = 0; i < N; i++){ cin >> a[i]; tmp[i] = a[i]; } int cnt = 0; for(int i = 0; i < N; i++){ if(i != -1 && i == tmp[a[i]]){ cnt++; tmp[i] = -1; tmp[a[i]] = -1; } } cout << cnt << endl; }
Submission Info
Submission Time | |
---|---|
Task | B - Friendly Rabbits |
User | yuta0802 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 465 Byte |
Status | WA |
Exec Time | 31 ms |
Memory | 1024 KB |
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 | AC | 3 ms | 256 KB |
0_01.txt | AC | 2 ms | 256 KB |
0_02.txt | AC | 3 ms | 256 KB |
1_00.txt | WA | 2 ms | 256 KB |
1_01.txt | WA | 31 ms | 1024 KB |
1_02.txt | AC | 31 ms | 1024 KB |
1_03.txt | WA | 31 ms | 1024 KB |
1_04.txt | WA | 31 ms | 1024 KB |
1_05.txt | WA | 31 ms | 1024 KB |
1_06.txt | WA | 30 ms | 1024 KB |
1_07.txt | WA | 31 ms | 1024 KB |
1_08.txt | WA | 13 ms | 512 KB |
1_09.txt | WA | 26 ms | 896 KB |
1_10.txt | WA | 22 ms | 768 KB |
1_11.txt | WA | 7 ms | 384 KB |