# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1112582 | 2024-11-14T11:03:24 Z | Chinguun | Star triangles (IZhO11_triangle) | C++14 | 1 ms | 592 KB |
#include <bits/stdc++.h> using namespace std; #define int long long #define ff first #define ss second #define pb push_back const int N = 2e5 + 7; const int oo = 1e18; const int mod = 1e9 + 7; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<pii> vii; int n, x, y, ans; map <int, vi> mp; pii p[N]; 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
# | Verdict | Execution time | Memory | 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 | Runtime error | 1 ms | 592 KB | Execution killed with signal 11 |
6 | Halted | 0 ms | 0 KB | - |