Submission #891766


Source Code Expand

#include <cassert>
#include <cctype>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <deque>
#include <functional>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <fstream>
#include <iostream>
#include <sstream>
#include <iomanip>

using namespace std;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef long long ll;
#define ALL(c) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
#define SORT(c) sort(ALL(c))
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define NEXTP(c) next_permutation(ALL(c))
#define SUM(c) accumulate(ALL(c),0)
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define ANS(x) cout << (x) << endl;
#define DUMP(x) cerr << #x << " = " << (x) << endl;
#define INF 1000000000 // 10^9
const double EPS = 1e-10;

int main(){
    int N;
    cin >> N;

    bool like[N+1][N+1] = {};
    int ret = 0;
    REP(i, N){
        int a;
        cin >> a;
        if(like[i+1][a]) ret++;
        else like[i+1][a] = like[a][i+1] = true;
    }
    cout << ret << endl;
    return 0;
}

Submission Info

Submission Time
Task B - Friendly Rabbits
User wat_shun
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1351 Byte
Status RE
Exec Time 896 ms
Memory 384 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 200
Status
AC × 3
AC × 4
RE × 11
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 384 KB
1_00.txt AC 2 ms 256 KB
1_01.txt RE 896 ms 256 KB
1_02.txt RE 111 ms 256 KB
1_03.txt RE 111 ms 256 KB
1_04.txt RE 113 ms 256 KB
1_05.txt RE 112 ms 256 KB
1_06.txt RE 114 ms 256 KB
1_07.txt RE 113 ms 256 KB
1_08.txt RE 113 ms 256 KB
1_09.txt RE 114 ms 256 KB
1_10.txt RE 112 ms 256 KB
1_11.txt RE 111 ms 256 KB