답안 #333821

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
333821 2020-12-07T20:33:57 Z limabeans 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
424 ms 5868 KB
#include <bits/stdc++.h>
using namespace std;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;




int n;
vector<pair<int,int>> a;

map<int,int> onx, ony;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);

    cin>>n;
    a.resize(n);
    for (int i=0; i<n; i++) {
	cin>>a[i].first>>a[i].second;
	onx[a[i].first]++;
	ony[a[i].second]++;
    }


    ll res = 0;

    for (auto p: a) {
	res += 1ll*(onx[p.first]-1)*(ony[p.second]-1);
    }


    cout<<res<<endl;    
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 7 ms 876 KB Output is correct
13 Correct 7 ms 876 KB Output is correct
14 Correct 11 ms 1260 KB Output is correct
15 Correct 122 ms 4076 KB Output is correct
16 Correct 134 ms 4204 KB Output is correct
17 Correct 160 ms 4076 KB Output is correct
18 Correct 121 ms 4076 KB Output is correct
19 Correct 334 ms 5740 KB Output is correct
20 Correct 308 ms 5100 KB Output is correct
21 Correct 358 ms 5868 KB Output is correct
22 Correct 424 ms 5868 KB Output is correct