답안 #887998

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
887998 2023-12-15T17:42:12 Z gnu 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
271 ms 15028 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve()
{
//    ifstream fin("triangles.in");
//    ofstream fout("triangles.out");
    int n; cin >> n;
    map<int, int> x, y;
    vector<pair<int, int>> points;
    for (int i = 0; i < n; ++i) {
        int x1, y1; cin >> x1 >> y1;
        ++x[x1], ++y[y1];
        points.emplace_back(x1, y1);
    }
    ll ans = 0;
    for (auto p : points) {
        ans += (x[p.first]-1) * (y[p.second]-1);
    }
    cout << ans;

}

signed main()
{
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
//    ll t; cin >> t; while(t--)
    solve();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 596 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 5 ms 1024 KB Output is correct
13 Correct 6 ms 1128 KB Output is correct
14 Correct 10 ms 1372 KB Output is correct
15 Correct 81 ms 6088 KB Output is correct
16 Correct 92 ms 6480 KB Output is correct
17 Correct 81 ms 6088 KB Output is correct
18 Correct 82 ms 6276 KB Output is correct
19 Correct 228 ms 13700 KB Output is correct
20 Correct 170 ms 9148 KB Output is correct
21 Correct 238 ms 13980 KB Output is correct
22 Correct 271 ms 15028 KB Output is correct