Submission #891700


Source Code Expand

#include <bits/stdc++.h>              
using namespace std;                 
using ll = long long;               
using vl = vector<ll>;              
using vvl = vector<vl>;            
using pll = pair<ll,ll>;                 
using vb = vector<bool>;                 
const ll oo = 0x3f3f3f3f3f3f3f3fLL;      
const double eps = 1e-9;                 
#define sz(c) ll((c).size())             
#define all(c) begin(c),end(c)           
#define mp make_pair                     
#define mt make_tuple                    
#define pb push_back                     
#define eb emplace_back                  
#define xx first                         
#define yy second                       
#define has(c,i) ((c).find(i) != end(c))
#define FOR(i,a,b) for (int i=(a); i<(b); i++)       
#define FORD(i,a,b) for (int i=int(b)-1; i>=(a); i--)
#define DB(X) ({ if(1) cerr << "DB: " << (#X) << " = " << (X) << endl; })

int main() { 
  ios::sync_with_stdio(false); 
  ll n;
  cin >> n;
  ll a[n];
  FOR(i,0,n){
    cin >> a[i];
    a[i]--;
  }
  ll res = 0;
  FOR(i,0,n){
    if(a[i] > i && a[a[i]] == i) res++;
  }
  cout << res << endl;
}

Submission Info

Submission Time
Task A - CODEFESTIVAL 2016
User mirithering
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1170 Byte
Status WA
Exec Time 3 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 100
Status
WA × 3
WA × 6
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
Case Name Status Exec Time Memory
0_00.txt WA 3 ms 256 KB
0_01.txt WA 3 ms 256 KB
0_02.txt WA 3 ms 256 KB
1_00.txt WA 3 ms 256 KB
1_01.txt WA 3 ms 256 KB
1_02.txt WA 3 ms 256 KB