답안 #532234

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
532234 2022-03-02T14:31:27 Z andecaandeci 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
364 ms 13352 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
int main(){
    int tc;
    scanf("%d",&tc);
    vector<pair<int,int> > v;
    map <int,int> mpx,mpy;
    for(int i=1;i<=tc;i++){
        int x,y;
        scanf("%d%d",&x,&y);
        mpx[x]++;
        mpy[y]++;
        v.push_back(make_pair(x,y));
    }
    int ans = 0;
    for(auto p : v){
        int x = p.fi,y = p.se;
        ans += (mpx[x] - 1) * (mpy[y] - 1);
    }
    printf("%d",ans);
    return 0;
}

Compilation message

triangle.cpp: In function 'int main()':
triangle.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d",&tc);
      |     ~~~~~^~~~~~~~~~
triangle.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         scanf("%d%d",&x,&y);
      |         ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 288 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 292 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 292 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 292 KB Output is correct
11 Correct 1 ms 300 KB Output is correct
12 Correct 7 ms 972 KB Output is correct
13 Correct 9 ms 948 KB Output is correct
14 Correct 9 ms 1332 KB Output is correct
15 Correct 106 ms 6036 KB Output is correct
16 Correct 116 ms 6428 KB Output is correct
17 Correct 111 ms 6172 KB Output is correct
18 Correct 100 ms 6148 KB Output is correct
19 Correct 343 ms 13328 KB Output is correct
20 Correct 212 ms 9136 KB Output is correct
21 Correct 364 ms 13352 KB Output is correct
22 Correct 326 ms 13256 KB Output is correct