답안 #340859

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
340859 2020-12-28T12:47:07 Z Edbert2397 별들과 삼각형 (IZhO11_triangle) C++14
100 / 100
400 ms 12472 KB
# include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
typedef long long ll;
#define pii pair<int,int>
const int N = 3e5 + 5;
const int INF = 1e9;
const ll mod = 1e9+7;
int x[N],y[N];
map<int,int>row,col;
int n;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //freopen("triangles.in","r",stdin);
    //freopen("triangles.out","w",stdout);
    cin>>n;
    for(int i = 1;i<=n;i++){
        cin>>x[i]>>y[i];
        row[x[i]]++;
        col[y[i]]++;
    }
    ll ans = 0;
    for(int i = 1;i<=n;i++){
        ans += (1LL * (row[x[i]]-1) * (col[y[i]]-1));
    }
    cout<<ans<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 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 492 KB Output is correct
7 Correct 2 ms 384 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 1004 KB Output is correct
13 Correct 7 ms 1132 KB Output is correct
14 Correct 11 ms 1388 KB Output is correct
15 Correct 122 ms 6252 KB Output is correct
16 Correct 146 ms 6508 KB Output is correct
17 Correct 140 ms 6252 KB Output is correct
18 Correct 123 ms 6252 KB Output is correct
19 Correct 374 ms 11628 KB Output is correct
20 Correct 255 ms 9324 KB Output is correct
21 Correct 400 ms 12472 KB Output is correct
22 Correct 392 ms 12396 KB Output is correct