# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
678655 | yellowtoad | 별들과 삼각형 (IZhO11_triangle) | C++17 | 8 ms | 9940 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
using namespace std;
const long long int mod = 1e5+7;
long long int n, x, y, ans;
pair<long long int, long long int> a[3000100];
vector<pair<long long int,long long int>> hx[mod+10], hy[mod+10];
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i].first >> a[i].second;
for (int j = 0; j < hx[a[i].first%mod].size(); j++) {
if (hx[a[i].first%mod][j].first == a[i].first) {
hx[a[i].first%mod][j].second++;
goto skip;
}
}
hx[a[i].first%mod].push_back({a[i].first,1});
skip:;
for (int j = 0; j < hy[a[i].second%mod].size(); j++) {
if (hy[a[i].second%mod][j].first == a[i].second) {
hy[a[i].second%mod][j].second++;
goto skipp;
}
}
hy[a[i].second%mod].push_back({a[i].second,1});
skipp:;
}
for (int i = 1; i <= n; i++) {
for (int j = 0; j < hx[a[i].first%mod].size(); j++) {
if (hx[a[i].first%mod][j].first == a[i].first) {
x = hx[a[i].first%mod][j].second;
goto skippp;
}
}
skippp:;
for (int j = 0; j < hy[a[i].second%mod].size(); j++) {
if (hy[a[i].second%mod][j].first == a[i].second) {
y = hy[a[i].second%mod][j].second;
goto skipppp;
}
}
skipppp:;
ans += (x-1)*(y-1);
}
cout << ans << endl;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |