Submission #304156

# Submission time Handle Problem Language Result Execution time Memory
304156 2020-09-21T03:43:38 Z _Yo_S_iN_ Star triangles (IZhO11_triangle) C++17
100 / 100
971 ms 9208 KB
#include<bits/stdc++.h>
#define pb push_back
#define ll long long
using namespace std;
ll n, m, x,cnt , a;
void solve(){
    map<ll , ll>used , used1;
    cin >> n;
    ll arr[n] , b[n];
    for( int i = 0;i < n;i ++ ){
        cin >> arr[i] >> b[i];
        used[arr[i]] ++;
        used1[b[i]] ++;
    }
    for( int i = 0;i < n;i ++ ){
        cnt+=(used[arr[i]] - 1) * (used1[b[i]] - 1);
    }
    cout << cnt;
}

int main(){
        solve();

}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 19 ms 1152 KB Output is correct
13 Correct 23 ms 1144 KB Output is correct
14 Correct 27 ms 1528 KB Output is correct
15 Correct 308 ms 5752 KB Output is correct
16 Correct 346 ms 6008 KB Output is correct
17 Correct 312 ms 5880 KB Output is correct
18 Correct 318 ms 5752 KB Output is correct
19 Correct 902 ms 8696 KB Output is correct
20 Correct 634 ms 7544 KB Output is correct
21 Correct 960 ms 9208 KB Output is correct
22 Correct 971 ms 9208 KB Output is correct