QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#796565 | #7276. A Light Inconvenience | omsincoconut | Compile Error | / | / | C++14 | 1.2kb | 2024-12-01 21:15:50 | 2024-12-01 21:15:50 |
Judging History
answer
#include "light.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<ll> cur;
void prepare() {
cur = {1};
}
pair<ll, vector<ll>> join(ll p) {
ll cz = cur.back() + p;
vector<ll> newcur;
newcur.push_back(1);
for (ll i = 1; cz-i+1 > 1; i *= 2) newcur.push_back(cz-i+1);
sort(newcur.begin(), newcur.end());
newcur.resize(unique(newcur.begin(), newcur.end()) - newcur.begin());
vector<ll> actual;
ll t = 5*p;
for (ll i : newcur) {
ll gap = i - *(upper_bound(cur.begin(), cur.end(), i) - 1);
if (gap <= t) actual.push_back(i);
}
cur = actual;
return make_pair(t, cur);
}
pair<ll, vector<ll>> leave(ll p){
ll cz = cur.back() - p;
vector<ll> newcur;
newcur.push_back(1);
for (ll i = 1; cz-i+1 > 1; i *= 2) newcur.push_back(cz-i+1);
sort(newcur.begin(), newcur.end());
newcur.resize(unique(newcur.begin(), newcur.end()) - newcur.begin());
vector<ll> actual;
ll t = 5*p;
for (ll i : newcur) {
ll gap = i - *(upper_bound(cur.begin(), cur.end(), i) - 1);
if (gap <= t) actual.push_back(i);
}
cur = actual;
return make_pair(t, cur);
}
Details
implementer.cpp:17:22: error: ‘optional’ does not name a type 17 | template<typename T> optional<T> read() { | ^~~~~~~~ implementer.cpp: In function ‘int main()’: implementer.cpp:36:17: error: ‘optional’ was not declared in this scope 36 | optional<long long> d = read<long long>(); | ^~~~~~~~ implementer.cpp:36:17: note: ‘std::optional’ is only available from C++17 onwards implementer.cpp:36:26: error: expected primary-expression before ‘long’ 36 | optional<long long> d = read<long long>(); | ^~~~ implementer.cpp:37:24: error: ‘d’ was not declared in this scope 37 | if(not d or *d == 0) | ^