# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
314264 | 2020-10-19T09:22:35 Z | Trickster | 별들과 삼각형 (IZhO11_triangle) | C++14 | 958 ms | 15612 KB |
#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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 0 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 1 ms | 376 KB | Output is correct |
9 | Correct | 1 ms | 384 KB | Output is correct |
10 | Correct | 1 ms | 384 KB | Output is correct |
11 | Correct | 3 ms | 384 KB | Output is correct |
12 | Correct | 19 ms | 1280 KB | Output is correct |
13 | Correct | 22 ms | 1280 KB | Output is correct |
14 | Correct | 28 ms | 1792 KB | Output is correct |
15 | Correct | 322 ms | 7928 KB | Output is correct |
16 | Correct | 358 ms | 8440 KB | Output is correct |
17 | Correct | 323 ms | 8056 KB | Output is correct |
18 | Correct | 313 ms | 7928 KB | Output is correct |
19 | Correct | 890 ms | 14780 KB | Output is correct |
20 | Correct | 636 ms | 11896 KB | Output is correct |
21 | Correct | 948 ms | 15612 KB | Output is correct |
22 | Correct | 958 ms | 15572 KB | Output is correct |