# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
18411 | kdh9949 | Star triangles (IZhO11_triangle) | C++98 | 291 ms | 8116 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
struct Point{
int x, y;
}p[300010];
int n, x[300010], y[300010], xsum[300010], ysum[300010];
ll ans;
int main(){
scanf("%d", &n);
for(int i = 0; i < n; i++){
scanf("%d%d", x + i, y + i);
p[i] = {x[i], y[i]};
}
sort(x, x + n);
sort(y, y + n);
for(int i = 0; i < n; i++){
p[i] = {(int)(lower_bound(x, x + n, p[i].x) - x), (int)(lower_bound(y, y + n, p[i].y) - y)};
xsum[p[i].x]++;
ysum[p[i].y]++;
}
for(int i = 0; i < n; i++){
ans += (ll)(xsum[p[i].x] - 1) * (ll)(ysum[p[i].y] - 1);
}
printf("%lld", ans);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |