Submission #1986576


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
static const int64_t INFL = 0x3F3F3F3F3F3F3F3FLL;
typedef int64_t ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
struct Solution {
    void solve(std::istream& in, std::ostream& out) {
        ll n;
        in >> n;
        vvll a(n, vll(n, INFL));
        ll ans = 0;
        for (int i = 0; i < n; i++) {
            ll t;
            in >> t;
            if (a[i][t - 1] != INFL) {
                ans++;
            }
            a[t - 1][i] = t;
        }
        out << ans << '\n';
    }
};
void solve(std::istream& in, std::ostream& out) {
    out << std::setprecision(12);
    Solution solution;
    solution.solve(in, out);
}
#include <fstream>
#include <iostream>
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    istream& in = cin;
    ostream& out = cout;
    solve(in, out);
    return 0;
}

Submission Info

Submission Time
Task B - Friendly Rabbits
User masakt
Language C++14 (GCC 5.4.1)
Score 0
Code Size 913 Byte
Status RE
Exec Time 2021 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 200
Status
AC × 3
AC × 4
MLE × 1
RE × 10
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 RE 1958 ms -678560 KB
1_02.txt RE 1695 ms -678452 KB
1_03.txt RE 1683 ms -678572 KB
1_04.txt RE 1669 ms -678456 KB
1_05.txt RE 1597 ms -678300 KB
1_06.txt RE 1572 ms -678048 KB
1_07.txt RE 1685 ms -678056 KB
1_08.txt RE 2021 ms -677536 KB
1_09.txt RE 1671 ms -677740 KB
1_10.txt RE 1686 ms -677848 KB
1_11.txt MLE 988 ms -1998220 KB