Submission #1822139


Source Code Expand

Copy
#include <bits/stdc++.h>
#define MOD 1000000007
#define int long long
using namespace std;

int state[50];

void ask(int a,int b){
	cout << "?";
	int tmp = 1;
	for(int i = 0;i < n;i++){
		if(a <= i && i < b){
			cout << " " << tmp;
			tmp *= 5;
		}
		else cout << " 0";
	}
	cout << endl;
	int cnt;
	cin >> cnt;
	tmp /= 5;
	for(int i = b - 1;i >= a;i--){
		int g = cnt / tmp;
		cnt %= tmp;
		tmp /= 5;
		if(g % 2) state[i] = 1;
		else state[i] = 0;
	}
}

signed main(){
	int n;
	cin >> n;
	for(int i = 0;i < (n + 5) / 6;i++) ask(i,min(i + 6,n));
	cout << "!";
	for(int i = 0;i < n;i++) cout << " " << state[i];
	cout << endl;
	return 0;
}

Submission Info

Submission Time
Task E - Coin Authentication
User hoget157
Language C++14 (GCC 5.4.1)
Score 0
Code Size 675 Byte
Status CE

Compile Error

./Main.cpp: In function ‘void ask(long long int, long long int)’:
./Main.cpp:11:20: error: ‘n’ was not declared in this scope
  for(int i = 0;i < n;i++){
                    ^