# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
27258 | 2017-07-11T23:20:16 Z | TAMREF | 별들과 삼각형 (IZhO11_triangle) | C++11 | 269 ms | 9052 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int mx=3e5+5; int x[mx], y[mx], xc[mx], yc[mx], xo[mx], yo[mx]; int main(){ int N; scanf("%d",&N); for(int i=0;i<N;i++){ scanf("%d%d",&x[i],&y[i]); xc[i]=x[i], yc[i]=y[i]; } int u,v; sort(xc,xc+N); u=unique(xc,xc+N)-xc; sort(yc,yc+N); v=unique(yc,yc+N)-yc; for(int i=0;i<N;i++){ x[i]=lower_bound(xc,xc+u,x[i])-xc; ++xo[x[i]]; y[i]=lower_bound(yc,yc+v,y[i])-yc; ++yo[y[i]]; } ll ans=0; for(int i=0;i<N;i++){ ans+=1LL*(xo[x[i]]-1)*(yo[y[i]]-1); } printf("%lld\n",ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 9052 KB | Output is correct |
2 | Correct | 0 ms | 9052 KB | Output is correct |
3 | Correct | 0 ms | 9052 KB | Output is correct |
4 | Correct | 0 ms | 9052 KB | Output is correct |
5 | Correct | 0 ms | 9052 KB | Output is correct |
6 | Correct | 0 ms | 9052 KB | Output is correct |
7 | Correct | 0 ms | 9052 KB | Output is correct |
8 | Correct | 0 ms | 9052 KB | Output is correct |
9 | Correct | 0 ms | 9052 KB | Output is correct |
10 | Correct | 0 ms | 9052 KB | Output is correct |
11 | Correct | 0 ms | 9052 KB | Output is correct |
12 | Correct | 6 ms | 9052 KB | Output is correct |
13 | Correct | 6 ms | 9052 KB | Output is correct |
14 | Correct | 6 ms | 9052 KB | Output is correct |
15 | Correct | 79 ms | 9052 KB | Output is correct |
16 | Correct | 99 ms | 9052 KB | Output is correct |
17 | Correct | 79 ms | 9052 KB | Output is correct |
18 | Correct | 76 ms | 9052 KB | Output is correct |
19 | Correct | 239 ms | 9052 KB | Output is correct |
20 | Correct | 173 ms | 9052 KB | Output is correct |
21 | Correct | 269 ms | 9052 KB | Output is correct |
22 | Correct | 233 ms | 9052 KB | Output is correct |