Submission #531774

#TimeUsernameProblemLanguageResultExecution timeMemory
531774bonkStar triangles (IZhO11_triangle)C++14
100 / 100
591 ms6696 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(){ int n; cin >> n; pair<int, int>pii[n]; map<int, ll>cntX, cntY; for(int i = 0; i < n; i++){ auto &[x, y] = pii[i]; cin >> x >> y; cntX[x]++; cntY[y]++; } ll ans = 0; for(int i = 0; i < n; i++){ auto &[x, y] = pii[i]; ans += max(0LL, (cntX[x] - 1)*(cntY[y] - 1)); } cout << ans << endl; return 0; }

Compilation message (stderr)

triangle.cpp: In function 'int main()':
triangle.cpp:12:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   12 |         auto &[x, y] = pii[i];
      |               ^
triangle.cpp:21:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   21 |         auto &[x, y] = pii[i];
      |               ^
#Verdict Execution timeMemoryGrader output
Fetching results...