Submission #412675

# Submission time Handle Problem Language Result Execution time Memory
412675 2021-05-27T10:24:13 Z tempus Star triangles (IZhO11_triangle) C++17
0 / 100
3 ms 332 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);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -