Submission #1075042

# Submission time Handle Problem Language Result Execution time Memory
1075042 2024-08-25T17:50:52 Z pawned COVID tests (CEOI24_covid) C++17
Compilation error
0 ms 0 KB
#pragma GCC optimize("O1,O2,O3,Ofast,unroll-loops")

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

#define fi first
#define se second
#define pb push_back
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;

const char nl = '\n';

void fastIO() {
	ios::sync_with_stdio(false);
	cin.tie(0);
}

int N, T;
double P;

char query(vi v) {
	string s(N, '0');
	for (int x : v)
		s[x] = '1';
	cout<<"Q "<<s<<endl;
	cout.flush();
	char c;
	cin>>c;
	return c;
}

char query(int l, int r) {
	string s(N, '0');
	for (int i = l; i <= r; i++) {
		s[i] = '1';
	}
	cout<<"Q "<<s<<endl;
	cout.flush();
	char c;
	cin>>c;
	return c;
}

int main() {
	fastIO();
	cin>>N>>P>>T;
	int len = max(5, min((int)(1.0 / P) + 1, 500));
	int len = 50;
	for (int i = 0; i < T; i++) {
		string ans(N, '0');
		for (int j = 0; j < N; j += len) {
			int lp = j;
			int rp = min(j + len - 1, N - 1);
			if (query(lp, rp) == 'N')
				continue;
			if (lp == rp) {
				ans[lp] = '1';
				continue;
			}
			for (int k = lp; k <= rp; k++) {
				vi v;
				v.pb(k);
				char c = query(v);
				if (c == 'P')
					ans[k] = '1';
			}
		}
//		cout<<"ANSWER: ";
		cout<<"A "<<ans<<endl;
		cout.flush();
		char c;
		cin>>c;
		if (c == 'W')
			break;
	}
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:50:6: error: redeclaration of 'int len'
   50 |  int len = 50;
      |      ^~~
Main.cpp:49:6: note: 'int len' previously declared here
   49 |  int len = max(5, min((int)(1.0 / P) + 1, 500));
      |      ^~~