Submission #891690
Source Code Expand
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <cstring> #include <sstream> #include <map> #include <set> #include <cmath> #include <queue> #include <stack> #include <list> #include <numeric> #include <bitset> #include <ext/algorithm> #include <ext/numeric> #define ffor(_a,_f,_t) for(int _a=(_f),__t=(_t);_a<__t;_a++) #define all(_v) (_v).begin() , (_v).end() #define sz size() #define pb push_back #define SET(__set, val) memset(__set, val, sizeof(__set)) #define FOR(__i, __n) ffor (__i, 0, __n) typedef long long LL; using namespace std; int main() { int n; cin >> n; int a[n + 1]; FOR (i, n) cin >> a[i + 1]; int cnt = 0; ffor (i, 1, n + 1) if (a[i] < i) cnt += a[a[i]] == i; cout << cnt << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Friendly Rabbits |
User | boba5551 |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 804 Byte |
Status | AC |
Exec Time | 35 ms |
Memory | 640 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 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 | 3 ms | 256 KB |
1_00.txt | AC | 3 ms | 256 KB |
1_01.txt | AC | 35 ms | 640 KB |
1_02.txt | AC | 35 ms | 640 KB |
1_03.txt | AC | 35 ms | 640 KB |
1_04.txt | AC | 35 ms | 640 KB |
1_05.txt | AC | 35 ms | 640 KB |
1_06.txt | AC | 35 ms | 640 KB |
1_07.txt | AC | 35 ms | 640 KB |
1_08.txt | AC | 14 ms | 384 KB |
1_09.txt | AC | 29 ms | 512 KB |
1_10.txt | AC | 25 ms | 512 KB |
1_11.txt | AC | 8 ms | 256 KB |