답안 #531774

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
531774 2022-03-01T13:16:51 Z bonk 별들과 삼각형 (IZhO11_triangle) C++14
100 / 100
591 ms 6696 KB
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main(){
    int n; cin >> n;
    pair<int, int>pii[n];
    map<int, ll>cntX, cntY;

    for(int i = 0; i < n; i++){
        auto &[x, y] = pii[i];
        cin >> x >> y;
        cntX[x]++;
        cntY[y]++;
    }

    ll ans = 0;

    for(int i = 0; i < n; i++){
        auto &[x, y] = pii[i];
        ans += max(0LL, (cntX[x] - 1)*(cntY[y] - 1));
    }

    cout << ans << endl;

    return 0;
}

Compilation message

triangle.cpp: In function 'int main()':
triangle.cpp:12:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   12 |         auto &[x, y] = pii[i];
      |               ^
triangle.cpp:21:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   21 |         auto &[x, y] = pii[i];
      |               ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 11 ms 960 KB Output is correct
13 Correct 12 ms 972 KB Output is correct
14 Correct 24 ms 1444 KB Output is correct
15 Correct 200 ms 5008 KB Output is correct
16 Correct 212 ms 5080 KB Output is correct
17 Correct 163 ms 4900 KB Output is correct
18 Correct 167 ms 4952 KB Output is correct
19 Correct 578 ms 6436 KB Output is correct
20 Correct 335 ms 5924 KB Output is correct
21 Correct 521 ms 6696 KB Output is correct
22 Correct 591 ms 6664 KB Output is correct