# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
679984 | 2023-01-09T17:59:54 Z | Karuk | 별들과 삼각형 (IZhO11_triangle) | C++14 | 537 ms | 38920 KB |
#include<bits/stdc++.h> using namespace std; vector<int>x[600001]; vector<int>y[600001]; int main() { int n; cin>>n; set<int>s; pair<int,int>a[n]; for(int i=0;i<n;i++) { int x,y;cin>>x>>y; a[i]={x,y}; s.insert(x); s.insert(y); } vector<int>v; for(int i:s)v.push_back(i); map<int,int>m; for(int i=0;i<v.size();i++) { m[v[i]]=i; } for(int i=0;i<n;i++) { a[i].first=m[a[i].first]; a[i].second=m[a[i].second]; x[a[i].first].push_back(a[i].second); y[a[i].second].push_back(a[i].first); } long long ans=0; for(int i=0;i<n;i++) { ans+=(x[a[i].first].size()-1)*(y[a[i].second].size()-1); } cout<<ans<<endl; return 0; } /** 3 0 0 1 0 0 1 */
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 14 ms | 28372 KB | Output is correct |
2 | Correct | 14 ms | 28500 KB | Output is correct |
3 | Correct | 13 ms | 28372 KB | Output is correct |
4 | Correct | 18 ms | 28412 KB | Output is correct |
5 | Correct | 15 ms | 28372 KB | Output is correct |
6 | Correct | 16 ms | 28396 KB | Output is correct |
7 | Correct | 17 ms | 28380 KB | Output is correct |
8 | Correct | 14 ms | 28432 KB | Output is correct |
9 | Correct | 15 ms | 28500 KB | Output is correct |
10 | Correct | 14 ms | 28500 KB | Output is correct |
11 | Correct | 14 ms | 28500 KB | Output is correct |
12 | Correct | 27 ms | 29772 KB | Output is correct |
13 | Correct | 28 ms | 29784 KB | Output is correct |
14 | Correct | 32 ms | 30552 KB | Output is correct |
15 | Correct | 207 ms | 34612 KB | Output is correct |
16 | Correct | 189 ms | 34928 KB | Output is correct |
17 | Correct | 195 ms | 34708 KB | Output is correct |
18 | Correct | 169 ms | 34704 KB | Output is correct |
19 | Correct | 439 ms | 38416 KB | Output is correct |
20 | Correct | 340 ms | 36812 KB | Output is correct |
21 | Correct | 537 ms | 38864 KB | Output is correct |
22 | Correct | 462 ms | 38920 KB | Output is correct |