Submission #314264

#TimeUsernameProblemLanguageResultExecution timeMemory
314264TricksterStar triangles (IZhO11_triangle)C++14
100 / 100
958 ms15612 KiB
#include <algorithm> #include <string.h> #include <iostream> #include <stdio.h> #include <vector> #include <queue> #include <cmath> #include <set> #include <map> using namespace std; #define N 300010 #define ff first #define ss second #define ll long long #define pb push_back #define mod 1000000007 #define pii pair <ll, ll> #define sz(a) ll(a.size()) #pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") ll bigmod(ll a,ll e) {if(e==0)return 1;ll x=bigmod(a*a%mod,e>>1);return e&1?x*a%mod:x;} pii p[N]; ll n, x, y; map <ll, ll> R, C; int main() { cin >> n; ll ans = 0; for(ll i = 1; i <= n; i++) { cin >> x >> y; R[x]++, C[y]++; p[i] = {x, y}; } for(ll i = 1; i <= n; i++) ans += (R[p[i].ff] - 1) * (C[p[i].ss] - 1); cout << ans; }

Compilation message (stderr)

triangle.cpp:22: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
   22 | #pragma GCC optimization ("O3")
      | 
triangle.cpp:23: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
   23 | #pragma GCC optimization ("unroll-loops")
      |
#Verdict Execution timeMemoryGrader output
Fetching results...