Submission #381531

#TimeUsernameProblemLanguageResultExecution timeMemory
381531ismoilovStar triangles (IZhO11_triangle)C++14
100 / 100
405 ms13292 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define all(x) (x).begin(), (x).end() #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++) #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++) #define fm(a,i,c) for(int (a) = (i); (a) > (c); (a)--) #define fmm(a,i,c) for(int (a) = (i); (a) >= (c); (a)--) const int MAXX = 3e5+5; int x[MAXX], y[MAXX]; map <ll, ll> a, b; void S() { ll n, ans = 0; cin >> n; fpp(i,1,n) { cin >> x[i] >> y[i]; a[x[i]]++; b[y[i]]++; } fpp(i,1,n) { ans += 1LL * (a[x[i]]-1)*(b[y[i]]-1); } cout << ans; } int main() { IOS; S(); }

Compilation message (stderr)

triangle.cpp: In function 'void S()':
triangle.cpp:7:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    7 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
triangle.cpp:17:2: note: in expansion of macro 'fpp'
   17 |  fpp(i,1,n)
      |  ^~~
triangle.cpp:7:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    7 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
triangle.cpp:23:2: note: in expansion of macro 'fpp'
   23 |  fpp(i,1,n)
      |  ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...