# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
420254 | 2021-06-08T08:29:27 Z | cpp219 | 별들과 삼각형 (IZhO11_triangle) | C++14 | 400 ms | 15672 KB |
#pragma GCC optimization "O2" #pragma GCC optimization "unroll-loop" #pragma GCC target ("avx2") #include <bits/stdc++.h> #define ll long long #define ld long double #define fs first #define sc second using namespace std; const ll N = 3e5 + 9; const ll mod = 1e9 + 7; typedef pair<ll,ll> LL; map<ll,ll> mpx,mpy; ll n,ans; LL a[N]; int main(){ ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); #define task "tst" if (fopen(task".inp", "r")){ freopen(task".inp", "r", stdin); //freopen(task".out", "w", stdout); } cin>>n; for (ll i = 1;i <= n;i++){ cin>>a[i].fs>>a[i].sc; mpx[a[i].fs]++; mpy[a[i].sc]++; } for (ll i = 1;i <= n;i++){ ll p = mpx[a[i].fs] - 1,q = mpy[a[i].sc] - 1; ans += p*q; } cout<<ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 316 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 332 KB | Output is correct |
9 | Correct | 1 ms | 332 KB | Output is correct |
10 | Correct | 1 ms | 332 KB | Output is correct |
11 | Correct | 1 ms | 332 KB | Output is correct |
12 | Correct | 10 ms | 1164 KB | Output is correct |
13 | Correct | 8 ms | 1356 KB | Output is correct |
14 | Correct | 11 ms | 1740 KB | Output is correct |
15 | Correct | 125 ms | 7904 KB | Output is correct |
16 | Correct | 149 ms | 8272 KB | Output is correct |
17 | Correct | 125 ms | 7880 KB | Output is correct |
18 | Correct | 137 ms | 7876 KB | Output is correct |
19 | Correct | 400 ms | 14740 KB | Output is correct |
20 | Correct | 290 ms | 11836 KB | Output is correct |
21 | Correct | 397 ms | 15672 KB | Output is correct |
22 | Correct | 375 ms | 15560 KB | Output is correct |