Submission #293861

#TimeUsernameProblemLanguageResultExecution timeMemory
2938617_7_7Star triangles (IZhO11_triangle)C++17
0 / 100
2 ms384 KiB
#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 (stderr)

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);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...