Submission #561661

#TimeUsernameProblemLanguageResultExecution timeMemory
561661KiriLL1caStar triangles (IZhO11_triangle)C++14
100 / 100
300 ms13280 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define fr first #define sc second #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define pw(x) (1ll << x) #define sz(x) (int)((x).size()) #define pb push_back #define endl '\n' #define vec vector using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef long double ld; typedef pair <int, int> pii; template <typename T> inline bool umin (T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; } template <typename T> inline bool umax (T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <typename T> using oset = tree<T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>; inline void solve () { int n; cin >> n; vector <pii> a (n); map <int, ll> cntX, cntY; for (auto &[x, y] : a) cin >> x >> y, ++cntX[x], ++cntY[y]; ll ans = 0; for (auto &[x, y] : a) ans += (cntX[x] - 1) * (cntY[y] - 1); cout << ans << endl; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t = 1; //cin >> t; while (t--) solve(); return 0; }

Compilation message (stderr)

triangle.cpp: In function 'void solve()':
triangle.cpp:31:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   31 |       for (auto &[x, y] : a) cin >> x >> y, ++cntX[x], ++cntY[y];
      |                  ^
triangle.cpp:33:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   33 |       for (auto &[x, y] : a) ans += (cntX[x] - 1) * (cntY[y] - 1);
      |                  ^
#Verdict Execution timeMemoryGrader output
Fetching results...