# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
829400 | erray | Radio Towers (IOI22_towers) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "fish.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#include "/home/eagle/ioi22/debug.h"
#else
#define debug(...) void(37)
#endif
long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) {
vector<int> ord(M);
iota(ord.begin(), ord.end(), 0);
sort(ord.begin(), ord.end(), [&](int x, int y) {
return pair{X[x], Y[x]} < pair{X[y], Y[y]};
});
vector<pair<int, vector<array<int, 2>>>> gs;
vector<vector<long long>> pref;
gs.emplace_back(-1, vector<array<int, 2>>{});
pref.push_back(vector<long long>{0});
for (int i = 0; i < M; ++i) {
if (i == 0 || X[ord[i - 1]] != X[ord[i]]) {
gs.emplace_back(X[ord[i]], vector<array<int, 2>>{});
pref.push_back(vector<long long>{0});
}
gs.back().second.push_back({Y[ord[i]], W[ord[i]]});
pref.back().push_back(pref.back().back() + W[ord[i]]);