Submission #671811

#TimeUsernameProblemLanguageResultExecution timeMemory
671811moday_morningStar triangles (IZhO11_triangle)C++17
0 / 100
65 ms588 KiB
#include <bits/stdc++.h> #define int long long using namespace std; const int N = 300000; void usaco(string s) { freopen((s + ".in").c_str(), "r", stdin); freopen((s + ".out").c_str(), "w", stdout); } map <int, int> x, y; int a[1 + N][2]; void solve() { int n; cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i][0] >> a[i][1]; } for (int i = 1; i <= n; i++) { x[a[i][0]]++; y[a[i][1]]++; } int sum = 0; for (int i = 1;i <= n; i++) { sum += 1LL * (x[a[i][0]] - 1) * (y[a[i][1]] - 1); } cout << sum << "\n"; } signed main() { usaco("triangles"); ios_base::sync_with_stdio(false); cin.tie(NULL); int t = 1; // cin >> t; while (t--) { solve(); } }

Compilation message (stderr)

triangle.cpp: In function 'void usaco(std::string)':
triangle.cpp:7:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     freopen((s + ".in").c_str(), "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
triangle.cpp:8:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     freopen((s + ".out").c_str(), "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...