# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
671593 | 2022-12-13T09:10:22 Z | Baytoro | 별들과 삼각형 (IZhO11_triangle) | C++17 | 300 ms | 12600 KB |
#include <bits/stdc++.h> using namespace std; #define ios ios::sync_with_stdio(false); cin.tie(NULL); #define pb push_back #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define fr first #define sc second #define int long long #define endl '\n' void fopn(string name){ freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout); } const int INF=1e9+9,mod=1e9+7; int n,m; void solve(){ cin>>n; map<int,int> x,y; vector<pair<int,int>> vec; for(int i=0;i<n;i++){ int a,b;cin>>a>>b; vec.pb({a,b}); x[a]++,y[b]++; } int res=0; for(int i=0;i<n;i++){ res+=(x[vec[i].fr]-1)*(y[vec[i].sc]-1); } cout<<res; } main(){ ios; int T=1; //cin>>T; while(T--){ solve(); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 6 ms | 1104 KB | Output is correct |
13 | Correct | 6 ms | 1108 KB | Output is correct |
14 | Correct | 9 ms | 1532 KB | Output is correct |
15 | Correct | 106 ms | 5820 KB | Output is correct |
16 | Correct | 104 ms | 5944 KB | Output is correct |
17 | Correct | 95 ms | 5912 KB | Output is correct |
18 | Correct | 97 ms | 5836 KB | Output is correct |
19 | Correct | 270 ms | 12556 KB | Output is correct |
20 | Correct | 191 ms | 8352 KB | Output is correct |
21 | Correct | 300 ms | 12516 KB | Output is correct |
22 | Correct | 294 ms | 12600 KB | Output is correct |