QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#731954#7276. A Light InconvenienceRDFZchenyyCompile Error//C++14986b2024-11-10 12:28:522024-11-10 12:28:53

Judging History

你现在查看的是最新测评结果

  • [2024-11-10 12:28:53]
  • 评测
  • [2024-11-10 12:28:52]
  • 提交

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);
}

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)
      |                        ^