답안 #88529

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
88529 2018-12-06T10:41:42 Z 1Khan 별들과 삼각형 (IZhO11_triangle) C++14
100 / 100
553 ms 12140 KB
// In the name of GOD

#include <bits/stdc++.h>

using namespace std;

#define good exit(0);
#define nl endl
#define ios ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()
#define pb push_back
#define bb begin()
#define ee end()
#define ff first
#define ss second
#define ll long long
#define db double
#define pii pair<int, int>

const int N = 3e5 + 555;

int n;
map<int, int> m, k;
int a[N], b[N];
int main(){

     ios

     cin >> n;
     for(int i = 1; i <= n; ++i){
          cin >> a[i] >> b[i];
          m[a[i]]++;
          k[b[i]]++;
     }
     int ans = 0;
     for(int i = 1; i <= n; ++i){
          int q = m[a[i]] - 1;
          int w = k[b[i]] - 1;
          ans += (q * w);
     }
     cout << ans;
     return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 452 KB Output is correct
3 Correct 2 ms 584 KB Output is correct
4 Correct 2 ms 584 KB Output is correct
5 Correct 2 ms 584 KB Output is correct
6 Correct 3 ms 684 KB Output is correct
7 Correct 3 ms 684 KB Output is correct
8 Correct 2 ms 684 KB Output is correct
9 Correct 2 ms 684 KB Output is correct
10 Correct 3 ms 684 KB Output is correct
11 Correct 3 ms 684 KB Output is correct
12 Correct 10 ms 1428 KB Output is correct
13 Correct 10 ms 1512 KB Output is correct
14 Correct 16 ms 2028 KB Output is correct
15 Correct 195 ms 7108 KB Output is correct
16 Correct 197 ms 7336 KB Output is correct
17 Correct 191 ms 7336 KB Output is correct
18 Correct 165 ms 7336 KB Output is correct
19 Correct 477 ms 8764 KB Output is correct
20 Correct 373 ms 8764 KB Output is correct
21 Correct 553 ms 8784 KB Output is correct
22 Correct 510 ms 12140 KB Output is correct