답안 #716572

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
716572 2023-03-30T11:38:20 Z ngano_upat_na 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
1287 ms 30804 KB
#include "bits/stdc++.h"
using namespace std;
using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n;
    cin >> n;
    multiset<int> mx, my;
    vector<pair<int,int>> v(n);
    for (auto &e:v) {
        cin >> e.first >> e.second;
        mx.insert(e.first);
        my.insert(e.second);
    }   
    
    ll ans = 0;
    for (int i=0; i<n; i++) {
        int x = v[i].first, y = v[i].second;
        ll cx = mx.count(x) - 1;
        ll cy = my.count(y) - 1;
        ans = ans + (cx * cy);
    }   
    cout << ans;
}   
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 3 ms 340 KB Output is correct
12 Correct 110 ms 1236 KB Output is correct
13 Correct 319 ms 1312 KB Output is correct
14 Correct 9 ms 1236 KB Output is correct
15 Correct 260 ms 10444 KB Output is correct
16 Correct 249 ms 11368 KB Output is correct
17 Correct 215 ms 10472 KB Output is correct
18 Correct 220 ms 10532 KB Output is correct
19 Correct 1147 ms 28568 KB Output is correct
20 Correct 608 ms 20556 KB Output is correct
21 Correct 1287 ms 30716 KB Output is correct
22 Correct 1232 ms 30804 KB Output is correct