# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
887786 | 2023-12-15T08:24:06 Z | stdfloat | Star triangles (IZhO11_triangle) | C++17 | 382 ms | 25440 KB |
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; map<int, int> my; map<int, set<int>> mx; for (int i = 0; i < n; i++) { int x, y; cin >> x >> y; my[y]++; mx[x].insert(y); } int ans = 0; for (auto i : mx) { vector<int> p; for (auto j : i.second) p.push_back((p.empty() ? 0 : p.back()) + my[j] - 1); int x = -1; for (auto j : i.second) ans += (x == -1 ? 0 : p[x]) + p.back() - p[++x]; } cout << ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 360 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 604 KB | Output is correct |
12 | Correct | 7 ms | 1372 KB | Output is correct |
13 | Correct | 6 ms | 1884 KB | Output is correct |
14 | Correct | 9 ms | 2140 KB | Output is correct |
15 | Correct | 102 ms | 11668 KB | Output is correct |
16 | Correct | 122 ms | 12116 KB | Output is correct |
17 | Correct | 97 ms | 11692 KB | Output is correct |
18 | Correct | 98 ms | 11604 KB | Output is correct |
19 | Correct | 302 ms | 24060 KB | Output is correct |
20 | Correct | 221 ms | 18892 KB | Output is correct |
21 | Correct | 329 ms | 25428 KB | Output is correct |
22 | Correct | 382 ms | 25440 KB | Output is correct |