답안 #151203

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
151203 2019-09-02T07:08:14 Z dolphingarlic 별들과 삼각형 (IZhO11_triangle) C++14
100 / 100
498 ms 12408 KB
#include <bits/stdc++.h>
#pragma GCC Optimize("O3")
#define FOR(i, x, y) for (int i = x; i < y; i++)
#define MOD 1000000007
typedef long long ll;
using namespace std;

map<int, int> x, y;
pair<int, int> s[300001];

int main() {
    iostream::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    FOR(i, 0, n) {
        cin >> s[i].first >> s[i].second;
        x[s[i].first]++;
        y[s[i].second]++;
    }

    ll ans = 0;
    FOR(i, 0, n) {
        ans += (x[s[i].first] - 1) * (y[s[i].second] - 1);
    }

    cout << ans;
    return 0;
}

Compilation message

triangle.cpp:2:0: warning: ignoring #pragma GCC Optimize [-Wunknown-pragmas]
 #pragma GCC Optimize("O3")
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 10 ms 1016 KB Output is correct
13 Correct 10 ms 1144 KB Output is correct
14 Correct 15 ms 1528 KB Output is correct
15 Correct 159 ms 6264 KB Output is correct
16 Correct 171 ms 6648 KB Output is correct
17 Correct 154 ms 6240 KB Output is correct
18 Correct 159 ms 6188 KB Output is correct
19 Correct 451 ms 11612 KB Output is correct
20 Correct 384 ms 9340 KB Output is correct
21 Correct 494 ms 12408 KB Output is correct
22 Correct 498 ms 12248 KB Output is correct