Submission #891410
Source Code Expand
#include <bits/stdc++.h> using namespace std; #define AS(arr) (sizeof(arr)/sizeof(arr[0])) #define ALL(c) (c).begin(),(c).end() #define SIZE(a) int((a).size()) #define EACH(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it) #define REP(i,n) for(int i=0;i<(int)n;++i) #define DEBUG(x) cout<<#x<<": "<<x<<endl #define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl #define pb push_back #define mp make_pair typedef vector<int> VI; typedef vector<string> VS; typedef long long LL; const double EPS = 1e-11; #define EQ(a,b) (abs(a-b)<EPS) #define EQ0(x) (abs(x)<EPS) int a[100005]; int main(void){ int N; cin >> N; REP(i, N) { cin >> a[i]; } int ret = 0; REP(i, N) { if(a[a[i]] == i) { ret++; } } cout << ret << endl; }
Submission Info
Submission Time | |
---|---|
Task | B - Friendly Rabbits |
User | altema |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 877 Byte |
Status | WA |
Exec Time | 35 ms |
Memory | 768 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 | 2 ms | 256 KB |
0_01.txt | AC | 2 ms | 256 KB |
0_02.txt | AC | 2 ms | 256 KB |
1_00.txt | WA | 2 ms | 256 KB |
1_01.txt | WA | 35 ms | 768 KB |
1_02.txt | AC | 35 ms | 640 KB |
1_03.txt | WA | 35 ms | 640 KB |
1_04.txt | WA | 35 ms | 640 KB |
1_05.txt | WA | 35 ms | 640 KB |
1_06.txt | WA | 35 ms | 640 KB |
1_07.txt | WA | 35 ms | 640 KB |
1_08.txt | WA | 15 ms | 384 KB |
1_09.txt | WA | 29 ms | 512 KB |
1_10.txt | WA | 25 ms | 512 KB |
1_11.txt | WA | 8 ms | 256 KB |