QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#731954 | #7276. A Light Inconvenience | RDFZchenyy | Compile Error | / | / | C++14 | 986b | 2024-11-10 12:28:52 | 2024-11-10 12:28:53 |
Judging History
answer
#include<bits/stdc++.h>
using ll=long long;
std::vector<ll> now,nxt;
ll len=0;
void prepare(){
now.clear(); now.push_back(1);
len=1; return;
}
std::pair<ll,std::vector<ll> > join(ll x){
len+=x; nxt.clear();
ll lst=len; nxt.push_back(lst);
while(lst>1){
ll pre=len-2*(len-lst+1);
pre=std::max(pre,1ll);
for(ll i=0;i<=(ll)now.size()-1;i++){
if(now[i]+x>=pre){
pre=std::max(now[i],pre);
nxt.push_back(pre);
break;
}
}
lst=pre;
}
std::sort(nxt.begin(),nxt.end());
now=nxt;
return std::make_pair(x,nxt);
}
std::pair<ll,std::vector<ll> > leave(ll x){
len-=x; nxt.clear();
ll lst=len; nxt.push_back(lst);
while(lst>1){
ll pre=len-2*(len-lst+1);
pre=std::max(pre,1ll);
for(ll i=0;i<=(ll)now.size()-1;i++){
if(now[i]+x>=pre){
pre=std::max(now[i],pre);
nxt.push_back(pre);
break;
}
}
lst=pre;
}
std::sort(nxt.begin(),nxt.end());
now=nxt;
return std::make_pair(x,nxt);
}
详细
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) | ^