# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
724779 | Charizard2021 | Flight to the Ford (BOI22_communication) | C++17 | 3652 ms | 2140 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 "communication.h"
using namespace std;
struct Ranges {
long long left, right;
Ranges(long long left, long long right) : left(left), right(right) {}
bool inside(long long x) {
return left <= x && x < right;
}
long long sizeRange() {
return right - left;
}
Ranges smaller(long long start, long long s) {
return Ranges(min(right, left + start), min(right, left + start + s));
}
};
vector<Ranges> splitIntervals(vector<Ranges> v, long long start, long long s) {
vector<Ranges> right;
for(int i = 0; i < v.size(); i++){
if (s > 0 && v[i].sizeRange() - start > 0){
right.push_back(v[i].smaller(start, s));
}
s -= max(0ll, min(s, v[i].sizeRange() - start));
start -= min(start, v[i].sizeRange());
}
return right;
}
bool contains(vector<Ranges> v, long long x) {
for(int i = 0; i < v.size(); i++){
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |