# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
493515 | 2021-12-11T19:36:33 Z | reni | Star triangles (IZhO11_triangle) | C++14 | 131 ms | 14172 KB |
#include<iostream> #include<unordered_map> #define endl '\n' using namespace std; unordered_map<long long, long long>mpx, mpy; long long a[300000][2]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long i,j,x,y,n, br=0; cin>>n; for(i=0;i<n;i++) { cin>>x>>y; a[i][0]=x; a[i][1]=y; mpx[x]++; mpy[y]++; } for(i=0;i<n;i++) { x=a[i][0]; y=a[i][1]; if(mpx.count(x) && mpy.count(y))br+=(mpx[x]-1)*(mpy[y]-1); } cout<<br<<endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 320 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 | 204 KB | Output is correct |
8 | Correct | 1 ms | 332 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 | 5 ms | 972 KB | Output is correct |
13 | Correct | 5 ms | 968 KB | Output is correct |
14 | Correct | 6 ms | 1356 KB | Output is correct |
15 | Correct | 44 ms | 6540 KB | Output is correct |
16 | Correct | 46 ms | 7016 KB | Output is correct |
17 | Correct | 42 ms | 6624 KB | Output is correct |
18 | Correct | 51 ms | 6568 KB | Output is correct |
19 | Correct | 123 ms | 13360 KB | Output is correct |
20 | Correct | 95 ms | 10380 KB | Output is correct |
21 | Correct | 131 ms | 14172 KB | Output is correct |
22 | Correct | 116 ms | 14076 KB | Output is correct |