Submission #826749

# Submission time Handle Problem Language Result Execution time Memory
826749 2023-08-16T02:00:51 Z jamezzz Ancient Machine 2 (JOI23_ancient2) C++17
0 / 100
1 ms 208 KB
#include "ancient2.h"
#include <bits/stdc++.h>
using namespace std;

#define pf printf
#define pb push_back
#define sz(x) ((int)x.size())

string Solve(int N){
	int know=0;
	string ans="";
	while(know!=N){
		vector<int> a,b;
		for(int i=0;i<know;++i){
			a.pb(i+1);
			b.pb(i+1);
		}
		int cur=know,num=1;
		while(cur+3*num<=1002&&know!=N){
			int ptr=cur+num;
			for(int i=cur;i<cur+num;++i){
				a.pb(ptr++);
				b.pb(ptr++);
			}
			cur=cur+num;
			num*=2;
			++know;
		}
		for(int i=cur;i<cur+num;++i){
			a.pb(i),b.pb(i);
		}
		pf("%d:\n",sz(a));
		for(int i:a)pf("%d ",i);pf("\n");
		for(int i:b)pf("%d ",i);pf("\n");
		int res=Query(sz(a),a,b);
		res-=cur;
		vector<char> v;
		while(num!=1){
			v.pb((res&1)+'0');
			res>>=1;
			num>>=1;
		}
		while(!v.empty()){
			ans.pb(v.back());
			pf("add %c\n",v.back());
			v.pop_back();
		}
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -