Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int n, m, h;
- bool usm[200][200], ush[200][200];
- piii mx[MAXN], mn;
- int cnt[MAXN];
- piii con(int i, int j, int k)
- {
- return { i, {j, k} };
- }
- int main()
- {
- ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
- cout.precision(7);
- srand(89398);
- #ifdef _DEBUG
- auto _ = freopen("input.txt", "r", stdin);
- _ = freopen("output.txt", "w", stdout);
- #else
- //freopen("input.txt", "r", stdin);
- //freopen("output.txt", "w", stdout);
- //freopen("chess.in", "r", stdin);
- //freopen("chess.out", "w", stdout);
- #endif
- cin >> n;
- itn m = n * (n - 1) / 2;
- for (int i = 0; i < m; i++)
- {
- cin >> mx[i].yy.xx >> mx[i].yy.yy >> mx[i].xx;
- mx[i].yy.xx--;
- mx[i].yy.yy--;
- }
- sort(mx, mx + n);
- reverse(mx, mx + n);
- for (int i = 0; i < n; i++)
- cnt[i] = n - 1;
- ll ans = 0;
- for (int i = 0; i < m; i++)
- {
- cnt[mx[i].yy.xx]--;
- cnt[mx[i].yy.yy]--;
- ans += mx[i].xx * ((cnt[mx[i].yy.xx]) % 2 + (cnt[mx[i].yy.yy]) % 2);
- cout << ans << " " << mx[i].xx << " " << mx[i].yy.xx << " " << mx[i].yy.yy << "\n";
- }
- cout << ans;
- }
- 8 4 3 4
- 16 4 0 2
- 20 4 0 1
- 20 3 2 1
- 22 2 2 4
- 25 3 0 3
- 29 2 3 1
- 33 4 0 4
- 33 4 4 1
- 33 2 2 3
- 33
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement