답안 #293861

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
293861 2020-09-08T13:11:24 Z 7_7_7 별들과 삼각형 (IZhO11_triangle) C++17
0 / 100
2 ms 384 KB
#include <bits/stdc++.h>

using namespace std;

int n;
map<int, int> x;
map<int, int> y;
int main()
{
    ios_base::sync_with_stdio(false);

    freopen("triangles.in", "r", stdin);
    freopen("triangles.out", "w", stdout);

    cin >> n;
    vector<int> a(n + 1), b(n + 1);
    for(int i = 1; i <= n; i ++){
        cin >> a[i] >> b[i];
        x[a[i]] ++; y[b[i]] ++;
    }
    long long res = 0;
    for(int i = 1; i <= n; i ++){
        x[a[i]] --; y[b[i]] --;
        res += (x[a[i]] * 1ll * y[b[i]]);
        x[a[i]] ++; y[b[i]] ++;
    }
    cout << res << "\n";
}

Compilation message

triangle.cpp: In function 'int main()':
triangle.cpp:12:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   12 |     freopen("triangles.in", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
triangle.cpp:13:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   13 |     freopen("triangles.out", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -