제출 #1367373

#제출 시각아이디문제언어결과실행 시간메모리
1367373gvancakCOVID tests (CEOI24_covid)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long
using namespace std;
const ll N=505,INF=1e12;
ll x,n,t,ind,cur,pw[N];
char c;
string s,ans;
bool check(int l,int r){
	string ragac="";
	for (int i=0; i<n; i++) ragac+='0';
	for (int i=l; i<=r; i++) ragac[i]='1';
	cout<<"Q "<<ragac<<endl;
	cin >> c;
	if (c=='P') return 1;
	return 0; 
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    double p;
    cin >> n ;
    cin >> p;
    cin >> t;
 	ans="";
    for (int i=1; i<=n; i++) ans+='0';
    pw[0]=1;
    int bl;
    if (p<=0.011546) bl=(int)(0.6/p),r;
    else
    if (p==0.028545) bl=(int)(0.709/p),r;
    else
    if (p==0.039856) bl=(int)(0.709/p),r;
    else bl=(int)(0.55/p),r;
    
    for (int i=1; i<=log2(n); i++) pw[i]=pw[i-1]*2;
    while (t--){
    	ind=0; 
    	while (ind<n){
    		r=min(ind+bl-1,n-1);
    		if (check(ind,r)==0){
    			ind=r+1; continue;
			}
			cur=ind;
			for (int o=log2(n); o>=0; o--){
				if (cur+pw[o]>=r) continue;
				cur+=pw[o];
				if (check(ind,cur)) cur-=pw[o];
			}
			if (cur==ind && (ind==n-1 || check(ind,ind)==1)) cur--;
			cur++;
			ans[cur]='1';
			ind=cur+1;
		}
		cout<<"A "<<ans<<endl;
		cin >> c;
		if (c=='W') return 0;
		for (int i=0; i<n; i++) ans[i]='0';
	}

}

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'int main()':
Main.cpp:32:38: error: 'r' was not declared in this scope
   32 |     if (p<=0.011546) bl=(int)(0.6/p),r;
      |                                      ^
Main.cpp:34:40: error: 'r' was not declared in this scope
   34 |     if (p==0.028545) bl=(int)(0.709/p),r;
      |                                        ^
Main.cpp:36:40: error: 'r' was not declared in this scope
   36 |     if (p==0.039856) bl=(int)(0.709/p),r;
      |                                        ^
Main.cpp:37:27: error: 'r' was not declared in this scope
   37 |     else bl=(int)(0.55/p),r;
      |                           ^
Main.cpp:43:17: error: 'r' was not declared in this scope
   43 |                 r=min(ind+bl-1,n-1);
      |                 ^