Submission #1443487


Source Code Expand

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<ctime>
using namespace std;
int a,b,c,i,j,ask[100],q[100],v1[4000]={0},v2[4000]={0},d[100],ret[10000];
long long ans[100];
int main(){
	srand(clock());
	cin>>a>>b;//a honest b dishonest
    if(a<=b){
    	cout<<"Impossible"<<endl;
    	return 0;
    } 
    int n=sqrt(a+b);
    for(i=1;i<=n;i++){
    	ask[i]=rand()%(a+b);
    	while(v1[ask[i]]==1)ask[i]=rand()%(a+b);
    	v1[ask[i]]=1;
    	q[i]=rand()%(a+b);
    	while(v2[q[i]]==1){
    		q[i]=rand()%(a+b);
    	}
    	v2[q[i]]=1;
  //  	cout<<ask[i]<<' '<<q[i]<<endl;
    }
    for(i=1;i<=n;i++){
    	for(j=1;j<=n;j++){
    		printf("? %d %d\n",ask[i],q[j]);
    		char ch;
    		scanf("%ch",&ch);
    		ans[i]*=1000000009; 
    		if(ch=='Y'){
    			 ans[i]+=1000000007;
    		}
    	}
    }
    
    for(i=1;i<=n;i++){
    	for(j=1;j<=n;j++){
    		if(ans[i]==ans[j]){
    			d[i]++; 
    		}
    	}
    }
    int maxn=1;;
    for(i=1;i<=n;i++){
    	if(d[i]>d[maxn]){
    		maxn=i;
    	}
    }
    for(i=0;i<a+b;i++){
    	printf("? %d %d\n",ask[maxn],i);
    	char ch;
    	scanf("%ch",&ch);
    	if(ch=='Y'){
    		ret[i]=1;
    	}else{
    		ret[i]=0;
    	}
    }
    cout<<"! ";
    for(i=0;i<a+b;i++){
    	cout<<ret[i];
    }cout<<endl;
}

Submission Info

Submission Time
Task F - HonestOrUnkind
User kk2048
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1351 Byte
Status TLE
Exec Time 2107 ms
Memory 724 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:32:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
       scanf("%ch",&ch);
                       ^
./Main.cpp:56:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
      scanf("%ch",&ch);
                      ^

Judge Result

Set Name All
Score / Max Score 0 / 1300
Status
AC × 9
TLE × 117
Set Name Test Cases
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, 026.txt, 027.txt, 028.txt, 029.txt, 030.txt, 031.txt, 032.txt, 033.txt, 034.txt, 035.txt, 036.txt, 037.txt, 038.txt, 039.txt, 040.txt, 041.txt, 042.txt, 043.txt, 044.txt, 045.txt, 046.txt, 047.txt, 048.txt, 049.txt, 050.txt, 051.txt, 052.txt, 053.txt, 054.txt, 055.txt, 056.txt, 057.txt, 058.txt, 059.txt, 060.txt, 061.txt, 062.txt, 063.txt, 064.txt, 065.txt, 066.txt, 067.txt, 068.txt, 069.txt, 070.txt, 071.txt, 072.txt, 073.txt, 074.txt, 075.txt, 076.txt, 077.txt, 078.txt, 079.txt, 080.txt, 081.txt, 082.txt, 083.txt, 084.txt, 085.txt, 086.txt, 087.txt, 088.txt, 089.txt, 090.txt, 091.txt, 092.txt, 093.txt, 094.txt, 095.txt, 096.txt, 097.txt, 098.txt, 099.txt, 100.txt, 101.txt, 102.txt, 103.txt, 104.txt, 105.txt, 106.txt, 107.txt, 108.txt, 109.txt, 110.txt, 111.txt, 112.txt, 113.txt, 114.txt, 115.txt, 116.txt, 117.txt, 118.txt, 119.txt, 120.txt, 121.txt, 122.txt, 123.txt, 124.txt, 125.txt
Case Name Status Exec Time Memory
000.txt TLE 2103 ms 720 KB
001.txt TLE 2103 ms 720 KB
002.txt TLE 2103 ms 720 KB
003.txt TLE 2103 ms 720 KB
004.txt TLE 2103 ms 716 KB
005.txt TLE 2103 ms 724 KB
006.txt TLE 2103 ms 720 KB
007.txt TLE 2103 ms 592 KB
008.txt TLE 2103 ms 724 KB
009.txt TLE 2103 ms 592 KB
010.txt TLE 2103 ms 720 KB
011.txt TLE 2103 ms 720 KB
012.txt TLE 2103 ms 720 KB
013.txt TLE 2103 ms 720 KB
014.txt TLE 2103 ms 724 KB
015.txt TLE 2103 ms 588 KB
016.txt TLE 2103 ms 720 KB
017.txt TLE 2103 ms 720 KB
018.txt TLE 2103 ms 724 KB
019.txt TLE 2103 ms 592 KB
020.txt TLE 2103 ms 720 KB
021.txt TLE 2103 ms 592 KB
022.txt TLE 2103 ms 724 KB
023.txt TLE 2103 ms 720 KB
024.txt TLE 2103 ms 596 KB
025.txt TLE 2103 ms 592 KB
026.txt TLE 2103 ms 720 KB
027.txt TLE 2107 ms 724 KB
028.txt TLE 2103 ms 596 KB
029.txt TLE 2103 ms 720 KB
030.txt TLE 2103 ms 720 KB
031.txt TLE 2103 ms 724 KB
032.txt TLE 2103 ms 720 KB
033.txt TLE 2103 ms 720 KB
034.txt TLE 2103 ms 720 KB
035.txt TLE 2103 ms 724 KB
036.txt TLE 2103 ms 724 KB
037.txt TLE 2103 ms 596 KB
038.txt TLE 2103 ms 592 KB
039.txt TLE 2103 ms 720 KB
040.txt TLE 2103 ms 720 KB
041.txt TLE 2103 ms 724 KB
042.txt TLE 2103 ms 724 KB
043.txt TLE 2103 ms 720 KB
044.txt TLE 2103 ms 720 KB
045.txt TLE 2103 ms 720 KB
046.txt TLE 2103 ms 724 KB
047.txt TLE 2103 ms 724 KB
048.txt TLE 2103 ms 720 KB
049.txt TLE 2103 ms 720 KB
050.txt TLE 2103 ms 720 KB
051.txt TLE 2103 ms 720 KB
052.txt TLE 2103 ms 592 KB
053.txt TLE 2107 ms 592 KB
054.txt TLE 2103 ms 724 KB
055.txt TLE 2103 ms 716 KB
056.txt TLE 2103 ms 724 KB
057.txt TLE 2103 ms 720 KB
058.txt TLE 2103 ms 724 KB
059.txt TLE 2103 ms 592 KB
060.txt TLE 2103 ms 724 KB
061.txt TLE 2103 ms 592 KB
062.txt TLE 2103 ms 596 KB
063.txt TLE 2103 ms 720 KB
064.txt TLE 2103 ms 592 KB
065.txt TLE 2103 ms 724 KB
066.txt TLE 2103 ms 720 KB
067.txt TLE 2103 ms 724 KB
068.txt TLE 2103 ms 724 KB
069.txt TLE 2107 ms 724 KB
070.txt TLE 2103 ms 712 KB
071.txt TLE 2103 ms 724 KB
072.txt TLE 2103 ms 720 KB
073.txt TLE 2103 ms 592 KB
074.txt TLE 2103 ms 724 KB
075.txt TLE 2103 ms 592 KB
076.txt TLE 2103 ms 720 KB
077.txt TLE 2103 ms 596 KB
078.txt TLE 2103 ms 720 KB
079.txt TLE 2103 ms 720 KB
080.txt TLE 2103 ms 588 KB
081.txt TLE 2103 ms 720 KB
082.txt TLE 2103 ms 716 KB
083.txt TLE 2103 ms 724 KB
084.txt TLE 2103 ms 592 KB
085.txt TLE 2103 ms 720 KB
086.txt TLE 2103 ms 720 KB
087.txt TLE 2103 ms 724 KB
088.txt TLE 2103 ms 592 KB
089.txt TLE 2103 ms 596 KB
090.txt TLE 2103 ms 716 KB
091.txt TLE 2103 ms 724 KB
092.txt TLE 2103 ms 592 KB
093.txt TLE 2103 ms 720 KB
094.txt TLE 2103 ms 592 KB
095.txt TLE 2103 ms 588 KB
096.txt TLE 2103 ms 716 KB
097.txt TLE 2103 ms 724 KB
098.txt TLE 2103 ms 592 KB
099.txt TLE 2103 ms 720 KB
100.txt TLE 2103 ms 724 KB
101.txt TLE 2103 ms 592 KB
102.txt TLE 2103 ms 592 KB
103.txt TLE 2103 ms 596 KB
104.txt TLE 2103 ms 724 KB
105.txt TLE 2103 ms 720 KB
106.txt TLE 2103 ms 720 KB
107.txt TLE 2103 ms 724 KB
108.txt TLE 2103 ms 724 KB
109.txt TLE 2103 ms 596 KB
110.txt TLE 2103 ms 724 KB
111.txt TLE 2103 ms 724 KB
112.txt TLE 2103 ms 724 KB
113.txt TLE 2103 ms 720 KB
114.txt TLE 2103 ms 724 KB
115.txt TLE 2103 ms 596 KB
116.txt TLE 2103 ms 592 KB
117.txt AC 3 ms 724 KB
118.txt AC 3 ms 720 KB
119.txt AC 3 ms 596 KB
120.txt AC 3 ms 720 KB
121.txt AC 3 ms 720 KB
122.txt AC 3 ms 716 KB
123.txt AC 3 ms 592 KB
124.txt AC 3 ms 720 KB
125.txt AC 3 ms 716 KB