답안 #1114185

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1114185 2024-11-18T09:49:42 Z Icelast 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
291 ms 14664 KB
#include <iostream>
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll maxn = 2*1e5+5, INF = 4e18+9;
struct point{
    ll x, y;
};
void solve(){
    int n;
    cin >> n;
    vector<point> a(n+1);
    for(int i = 1; i <= n; i++){
        cin >> a[i].x >> a[i].y;
    }
    map<int, int> mpx, mpy;
    for(int i = 1; i <= n; i++){
        mpx[a[i].x]++;
        mpy[a[i].y]++;
    }
    ll ans = 0;
    for(int i = 1; i <= n; i++){
        ans += (long long)(mpx[a[i].x]-1) * (mpy[a[i].y]-1);
    }
    cout << ans;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 1 ms 472 KB Output is correct
3 Correct 1 ms 504 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 508 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 592 KB Output is correct
9 Correct 2 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 7 ms 1104 KB Output is correct
13 Correct 8 ms 1104 KB Output is correct
14 Correct 8 ms 1616 KB Output is correct
15 Correct 92 ms 7000 KB Output is correct
16 Correct 114 ms 7348 KB Output is correct
17 Correct 102 ms 6964 KB Output is correct
18 Correct 98 ms 6984 KB Output is correct
19 Correct 265 ms 13612 KB Output is correct
20 Correct 192 ms 10860 KB Output is correct
21 Correct 262 ms 14664 KB Output is correct
22 Correct 291 ms 14604 KB Output is correct