# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
20815 | jjwdi0 | Star triangles (IZhO11_triangle) | C++11 | 1293 ms | 36344 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define sz(x) ((int)(x).size())
using namespace std;
map<int, set<int>> s1, s2;
int N;
long long ans;
int main() {
scanf("%d", &N);
for(int i=0, x, y; i<N; i++) {
scanf("%d %d", &x, &y);
s1[x].insert(y);
s2[y].insert(x);
}
for(auto itr : s1) {
int i = itr.first;
if(sz(s1[i]) >= 2) {
for(auto it : s1[i]) {
ans += (long long)(sz(s1[i]) - 1) * (sz(s2[it]) - 1);
}
}
}
printf("%lld", ans);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |