답안 #412677

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
412677 2021-05-27T10:24:54 Z tempus 별들과 삼각형 (IZhO11_triangle) C++17
0 / 100
1 ms 204 KB
#include <bits/stdc++.h>

#define ll long long
#define endl "\n"
#define ios ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);

using namespace std;

int main() {
    //ios
    freopen("triangles.out", "w", stdout);
    freopen("triangles.in", "r", stdin);
    int n;
    cin >> n;
    ll x[n], y[n];
    map <ll, ll> m1, m2;
    for (int i = 0; i < n; ++ i) {
        cin >> x[i] >> y[i];
        m1[x[i]] ++;
        m2[y[i]] ++;
    }
    ll ans = 0;
    for (int i = 0; i < n; ++ i) {
        ans += (m1[x[i]] - 1) * (m2[y[i]] - 1);
    }
    cout << ans;
    return 0;
}

Compilation message

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