# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
87013 | 2018-11-29T07:52:12 Z | Aydarov03 | Star triangles (IZhO11_triangle) | C++14 | 1053 ms | 25096 KB |
#include <bits/stdc++.h> #define fr first #define sc second using namespace std; map<int , int> x , y; map <pair<int,int> , bool> used; vector < pair<int,int> > xy; main() { int n , ans = 0; cin >> n; for(int i = 1; i <= n; i++) { int a , b; scanf("%d%d" , &a , &b); if( used.count( { a,b } ) )continue; x[a]++; y[b]++; xy.push_back( {a , b} ); used[ {a,b} ] = 1; } for(int i = 0; i < xy.size(); i++) { if( y.count( xy[i].second ) ) ans += (x[ xy[i].first ]-1) * (y[ xy[i].second ] - 1) ; } cout << ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 448 KB | Output is correct |
4 | Correct | 2 ms | 448 KB | Output is correct |
5 | Correct | 2 ms | 628 KB | Output is correct |
6 | Correct | 2 ms | 640 KB | Output is correct |
7 | Correct | 2 ms | 640 KB | Output is correct |
8 | Correct | 2 ms | 700 KB | Output is correct |
9 | Correct | 2 ms | 700 KB | Output is correct |
10 | Correct | 3 ms | 700 KB | Output is correct |
11 | Correct | 3 ms | 700 KB | Output is correct |
12 | Correct | 16 ms | 1800 KB | Output is correct |
13 | Correct | 14 ms | 1820 KB | Output is correct |
14 | Correct | 21 ms | 2076 KB | Output is correct |
15 | Correct | 285 ms | 10656 KB | Output is correct |
16 | Correct | 332 ms | 11276 KB | Output is correct |
17 | Correct | 305 ms | 11276 KB | Output is correct |
18 | Correct | 276 ms | 11276 KB | Output is correct |
19 | Correct | 926 ms | 24388 KB | Output is correct |
20 | Correct | 695 ms | 24388 KB | Output is correct |
21 | Correct | 995 ms | 24956 KB | Output is correct |
22 | Correct | 1053 ms | 25096 KB | Output is correct |