# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1112585 | 2024-11-14T11:05:52 Z | Chinguun | 별들과 삼각형 (IZhO11_triangle) | C++14 | 391 ms | 15432 KB |
#include <bits/stdc++.h> using namespace std; #define int long long #define ff first #define ss second #define pb push_back typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<pii> vii; int n, x, y, ans; map <int, vi> mp; map <int, pii> p; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for (int i = 1; i <= n; i++) { cin >> x >> y; mp[x].pb (y); p[y].ff++; } for (auto it : mp) { vi v = it.ss; for (int i = 0; i < v.size (); i++) { ans += i * (p[v[i]].ss + p[v[i]].ff - 1); ans += (v.size () - i - 1) * (p[v[i]].ss + p[v[i]].ff - 1); p[v[i]].ff--; p[v[i]].ss++; } } cout << ans; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 508 KB | Output is correct |
7 | Correct | 1 ms | 336 KB | Output is correct |
8 | Correct | 1 ms | 336 KB | Output is correct |
9 | Correct | 1 ms | 632 KB | Output is correct |
10 | Correct | 1 ms | 464 KB | Output is correct |
11 | Correct | 1 ms | 336 KB | Output is correct |
12 | Correct | 9 ms | 1368 KB | Output is correct |
13 | Correct | 7 ms | 1616 KB | Output is correct |
14 | Correct | 13 ms | 2128 KB | Output is correct |
15 | Correct | 130 ms | 6436 KB | Output is correct |
16 | Correct | 143 ms | 8288 KB | Output is correct |
17 | Correct | 127 ms | 6476 KB | Output is correct |
18 | Correct | 129 ms | 8520 KB | Output is correct |
19 | Correct | 375 ms | 14452 KB | Output is correct |
20 | Correct | 241 ms | 8344 KB | Output is correct |
21 | Correct | 391 ms | 15432 KB | Output is correct |
22 | Correct | 362 ms | 15432 KB | Output is correct |