# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
171351 | 2019-12-28T11:29:07 Z | ASDF123 | 별들과 삼각형 (IZhO11_triangle) | C++14 | 639 ms | 13316 KB |
#include <bits/stdc++.h> using namespace std; #define all(s) s.begin(), s.end() #define szof(s) (int)s.size() #define pii pair<int, int> #define prev myyyyrza1 #define pb push_back #define y1 myyyyrza2 #define id id1234 #define fr first #define sc second #define OK() puts("OK") using namespace std; const int N = ((int)3e5 + 5); const int MOD = (1e9 + 7); const int INF = (0x3f3f3f3f); int X[N], Y[N]; map <int, long long> cntx, cnty; main() { int n; cin >> n; for (int i = 1; i <= n; i++) { scanf("%d%d", &X[i], &Y[i]); cnty[Y[i]]++; cntx[X[i]]++; } long long ans = 0; for (int i = 1; i <= n; i++) { int x = X[i], y = Y[i]; ans += (cntx[x] - 1) * (cnty[y] - 1); } cout << ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 248 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 3 ms | 376 KB | Output is correct |
12 | Correct | 11 ms | 1144 KB | Output is correct |
13 | Correct | 10 ms | 1276 KB | Output is correct |
14 | Correct | 16 ms | 1656 KB | Output is correct |
15 | Correct | 225 ms | 7328 KB | Output is correct |
16 | Correct | 219 ms | 7416 KB | Output is correct |
17 | Correct | 228 ms | 7136 KB | Output is correct |
18 | Correct | 248 ms | 7228 KB | Output is correct |
19 | Correct | 583 ms | 12572 KB | Output is correct |
20 | Correct | 415 ms | 10396 KB | Output is correct |
21 | Correct | 639 ms | 13316 KB | Output is correct |
22 | Correct | 639 ms | 13148 KB | Output is correct |