답안 #46822

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
46822 2018-04-23T16:42:15 Z Nnandi 별들과 삼각형 (IZhO11_triangle) C++14
100 / 100
474 ms 40048 KB
#include <bits/stdc++.h>
using namespace std;

map<int,int> x;
map<int,int> y;
vector<pair<int,int> > pont;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    for(int i=0;i<n;i++) {
        int a, b;
        cin>>a>>b;
        x[a]++;
        y[b]++;
        pont.push_back(make_pair(a,b));
    }
    long long sol=0LL;
    for(auto ez:pont) {
        sol+=(x[ez.first]-1)*(y[ez.second]-1);
    }
    cout<<sol<<endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 524 KB Output is correct
3 Correct 2 ms 644 KB Output is correct
4 Correct 2 ms 644 KB Output is correct
5 Correct 2 ms 692 KB Output is correct
6 Correct 2 ms 728 KB Output is correct
7 Correct 2 ms 840 KB Output is correct
8 Correct 2 ms 840 KB Output is correct
9 Correct 2 ms 840 KB Output is correct
10 Correct 3 ms 840 KB Output is correct
11 Correct 2 ms 840 KB Output is correct
12 Correct 14 ms 1448 KB Output is correct
13 Correct 9 ms 1728 KB Output is correct
14 Correct 16 ms 2236 KB Output is correct
15 Correct 168 ms 7196 KB Output is correct
16 Correct 163 ms 9704 KB Output is correct
17 Correct 167 ms 11780 KB Output is correct
18 Correct 167 ms 14092 KB Output is correct
19 Correct 451 ms 23276 KB Output is correct
20 Correct 400 ms 25216 KB Output is correct
21 Correct 474 ms 33656 KB Output is correct
22 Correct 458 ms 40048 KB Output is correct