Submission #814841

#TimeUsernameProblemLanguageResultExecution timeMemory
814841tranxuanbachAncient Machine 2 (JOI23_ancient2)C++17
10 / 100
202 ms424 KiB
#include "ancient2.h"

#include <bits/stdc++.h>
using namespace std;

namespace {
	int n;
	string ans;
}

string Solve(int _n){
	n = _n;
	ans = string(n, '?');
	array <int, 2> cnt;
	for (int i = 0; i < n; i++){
		vector <int> a(n + 2), b(n + 2);
		for (int j = 0; j < i; j++){
			a[j] = b[j] = j + 1;
		}
		a[i] = n;
		b[i] = n + 1;
		a[n] = b[n] = n;
		a[n + 1] = b[n + 1] = n + 1;
		if (Query(n + 2, a, b) == n){
			ans[i] = '0';
		}
		else{
			ans[i] = '1';
		}
	}
	return ans;
}

Compilation message (stderr)

ancient2.cpp: In function 'std::string Solve(int)':
ancient2.cpp:14:17: warning: unused variable 'cnt' [-Wunused-variable]
   14 |  array <int, 2> cnt;
      |                 ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...