# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
151573 | AlexPop28 | Race (IOI11_race) | C++11 | 593 ms | 87088 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "race.h"
using namespace std;
const int INF = (int)1e9;
struct MinMaxMerge {
map<int, int> dist;
int lazy_weight, lazy_edges;
MinMaxMerge() : lazy_weight(0), lazy_edges(0) {
dist.clear();
}
};
struct Solver {
Solver(int k_, const vector<vector<pair<int, int>>> &adj_) :
n(adj_.size()), k(k_), adj(adj_) {}
int n, k, ans = INF;
vector<vector<pair<int, int>>> adj;
void Merge(MinMaxMerge &curr, MinMaxMerge &him) {
if (curr.dist.size() < him.dist.size()) {
swap(curr, him);
}
for (auto &p : him.dist) {
int real_weight = p.first + him.lazy_weight;
int real_edges = p.second + him.lazy_edges;
int search = k - real_weight - curr.lazy_weight;
if (curr.dist.count(search)) {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |