Submission #170973

# Submission time Handle Problem Language Result Execution time Memory
170973 2019-12-26T21:05:02 Z achibasadzishvili Star triangles (IZhO11_triangle) C++14
100 / 100
549 ms 15708 KB
#include<bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pb push_back
using namespace std;
ll n,x[300005],ans,y[300005];
map<ll,ll>a,b;
int main(){
    ios::sync_with_stdio(false);
    cin >> n;
    for(int i=1; i<=n; i++){
        cin >> x[i] >> y[i];
        a[x[i]]++;
        b[y[i]]++;
    }
    for(int i=1; i<=n; i++)
        ans += (a[x[i]] - 1) * (b[y[i]] - 1);
    cout << ans << endl;
    
    
    
    
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 396 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 10 ms 1272 KB Output is correct
13 Correct 10 ms 1400 KB Output is correct
14 Correct 15 ms 1784 KB Output is correct
15 Correct 157 ms 7928 KB Output is correct
16 Correct 169 ms 8440 KB Output is correct
17 Correct 158 ms 8004 KB Output is correct
18 Correct 163 ms 8060 KB Output is correct
19 Correct 455 ms 14844 KB Output is correct
20 Correct 316 ms 12032 KB Output is correct
21 Correct 495 ms 15708 KB Output is correct
22 Correct 549 ms 15708 KB Output is correct