Submission #491566

# Submission time Handle Problem Language Result Execution time Memory
491566 2021-12-03T10:00:14 Z osmanallazov Star triangles (IZhO11_triangle) C++14
100 / 100
514 ms 13168 KB
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    ll n,x,y;
    ll res=0;
    map<ll,ll>m,p;
    cin>>n;
    int a[n],b[n];
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
        m[a[i]]++;
        p[b[i]]++;
    }
    for(int i=0;i<n;i++){
        res+=((m[a[i]]-1)*(p[b[i]]-1));
    }
    cout<<res;
}

Compilation message

triangle.cpp: In function 'int main()':
triangle.cpp:5:10: warning: unused variable 'x' [-Wunused-variable]
    5 |     ll n,x,y;
      |          ^
triangle.cpp:5:12: warning: unused variable 'y' [-Wunused-variable]
    5 |     ll n,x,y;
      |            ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 284 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 10 ms 1128 KB Output is correct
13 Correct 12 ms 1100 KB Output is correct
14 Correct 15 ms 1612 KB Output is correct
15 Correct 160 ms 6724 KB Output is correct
16 Correct 176 ms 6988 KB Output is correct
17 Correct 173 ms 7108 KB Output is correct
18 Correct 159 ms 7092 KB Output is correct
19 Correct 431 ms 12408 KB Output is correct
20 Correct 337 ms 10140 KB Output is correct
21 Correct 464 ms 13168 KB Output is correct
22 Correct 514 ms 13144 KB Output is correct