# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
226010 | emil_physmath | Segments (IZhO18_segments) | C++17 | 2089 ms | 12028 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 <algorithm>
#include <iostream>
#include <stdio.h>
#include <queue>
#include <vector>
#include <set>
using namespace std;
struct Inter { int l, r; };
bool operator<(const Inter& a, const Inter& b) { return a.r - a.l < b.r - b.l; }
const int maxN = 200'000;
const int bl = 1450;
struct
{
vector<int> ls[maxN / bl], rs[maxN / bl];
vector<Inter> seg;
vector<Inter> unProc;
void add(int l, int r)
{
unProc.push_back({l, r});
if (unProc.size() >= bl)
{
// Rebuild.
vector<Inter> temp; temp.reserve(seg.size() + unProc.size());
sort(unProc.begin(), unProc.end());
merge(unProc.begin(), unProc.end(), seg.begin(), seg.end(), back_inserter(temp));
seg.swap(temp);
unProc.clear();
for (int i = 0; i * bl < seg.size(); ++i)
{
Compilation message (stderr)
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |