| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 27258 | TAMREF | 별들과 삼각형 (IZhO11_triangle) | C++11 | 269 ms | 9052 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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);
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
