Submission #1444412
Source Code Expand
#pragma region include #include <iostream> #include <iomanip> #include <stdio.h> #include <sstream> #include <algorithm> #include <cmath> #include <complex> #include <string> #include <cstring> #include <vector> #include <tuple> #include <bitset> #include <queue> #include <complex> #include <set> #include <map> #include <stack> #include <list> #include <fstream> #include <random> //#include <time.h> #include <ctime> #pragma endregion //#include ///////// #define REP(i, x, n) for(int i = x; i < n; ++i) #define rep(i,n) REP(i,0,n) ///////// #pragma region typedef typedef long long LL; typedef long double LD; typedef unsigned long long ULL; #pragma endregion //typedef ////定数 const int INF = (int)1e9; const LL MOD = (LL)1e9+7; const LL LINF = (LL)1e18+20; const double PI = acos(-1.0); const double EPS = 1e-9; ///////// using namespace::std; void solve(){ int N; cin >> N; vector<int> A(N); for(int i=0;i<N;++i){ cin >> A[i]; --A[i]; } int ans = 0; for(int i=0;i<N;++i){ if( A[ A[i] ] == i ){ ++ans; } } cout << ans/2 << endl; } #pragma region main signed main(void){ std::cin.tie(0); std::ios::sync_with_stdio(false); std::cout << std::fixed;//小数を10進数表示 cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別 solve(); } #pragma endregion //main()
Submission Info
Submission Time | |
---|---|
Task | B - Friendly Rabbits |
User | akarin55 |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 1404 Byte |
Status | AC |
Exec Time | 9 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 | 1 ms | 256 KB |
0_01.txt | AC | 1 ms | 256 KB |
0_02.txt | AC | 1 ms | 256 KB |
1_00.txt | AC | 1 ms | 256 KB |
1_01.txt | AC | 9 ms | 640 KB |
1_02.txt | AC | 9 ms | 640 KB |
1_03.txt | AC | 9 ms | 640 KB |
1_04.txt | AC | 9 ms | 640 KB |
1_05.txt | AC | 9 ms | 640 KB |
1_06.txt | AC | 9 ms | 640 KB |
1_07.txt | AC | 9 ms | 640 KB |
1_08.txt | AC | 4 ms | 384 KB |
1_09.txt | AC | 8 ms | 640 KB |
1_10.txt | AC | 7 ms | 512 KB |
1_11.txt | AC | 2 ms | 384 KB |