제출 #413427

#제출 시각아이디문제언어결과실행 시간메모리
413427aris12345678Star triangles (IZhO11_triangle)C++14
100 / 100
396 ms12164 KiB
#include <bits/stdc++.h>
using namespace std;

const int mxN = 300005;
int x[mxN], y[mxN];

int main() {
    int n;
    scanf("%d", &n);
    map<int, int> x_axis, y_axis;
    for(int i = 0; i < n; i++) {
        scanf("%d %d", &x[i], &y[i]);
        x_axis[x[i]]++;
        y_axis[y[i]]++;
    }
    long long ans = 0;
    for(int i = 0; i < n; i++) {
        ans += (x_axis[x[i]]-1)*(y_axis[y[i]]-1);
    }
    printf("%d\n", ans);
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

triangle.cpp: In function 'int main()':
triangle.cpp:20:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
   20 |     printf("%d\n", ans);
      |             ~^     ~~~
      |              |     |
      |              int   long long int
      |             %lld
triangle.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
triangle.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         scanf("%d %d", &x[i], &y[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...