Submission #661473

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
6614732022-11-25 22:05:58yashsinghJob Scheduling (CEOI12_jobs)C++17
40 / 100
637 ms65536 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n, d, m;
bool sort2(pair<ll,ll>a,pair<ll,ll>b) {
return a.second < b.second;
}
bool val(ll machines, pair<ll,ll> a[]) {
map<ll,ll> ma;
ma.insert({0, machines});
pair<ll,ll> val;
for (ll i{0}; i < m; ++i) {
auto search = ma.upper_bound(a[i].first+d);
val = *prev(search);
if (search == ma.begin()) {
return 0;
} else {
prev(search)->second = val.second - 1;
if (val.second == 1) {
ma.erase(prev(search));
}
++ma[max(val.first, a[i].first)+1];
if (max(val.first, a[i].first) > n) {
return 0;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...