Submission #1049314

# Submission time Handle Problem Language Result Execution time Memory
1049314 2024-08-08T16:20:00 Z vjudge1 Light Bulbs (EGOI24_lightbulbs) C++17
22 / 100
60 ms 716 KB
#include <bits/stdc++.h>

using namespace std;

#define ar array
#define int long long
#define ld long double

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")

const int N = 200;
const int X = N * N;
const int K = 500;
const int MOD = 1e9 + 7;

const int LOG = 21;
const int INF = 1e17;

string ans[N];
int n;

int ask(int a, int b,int c,int d){
	string s[n];
	for(int i = 0;i < n;i++)s[i] = string(n, '0');
	s[a][b] = '1';
	s[c][d] = '1';
	cout<<"?"<<endl;
	for(int i = 0;i < n;i++)cout<<s[i]<<endl;
	int x;
	cin>>x;
	return x;
}

void find(int x,int y){
	if(ans[x][y] != '$')return;
	for(int i = 0;i < n;i++){
		if(ans[x][i] != '$'){
			if(ask(x, i, x, y) == 2 * n - 1)ans[x][y] = (ans[x][i] == 'V' ? 'H' : 'V');
			else ans[x][y] = ans[x][i];
			return;
		}
		if(ans[i][y] != '$'){
			if(ask(i, y, x, y) == 2 * n - 1)ans[x][y] = (ans[i][y] == 'V' ? 'H' : 'V');
			else ans[x][y] = ans[i][y];
			return;
		}
	}
}
bitset<N> res[N];
void hor(){
	for(int i = 0;i < n;i++){
		for(int j = 0;j < n;j++){
			if(ans[i][j] == 'H'){
				res[i][j] = 1;
				break;
			}
		}
	}
	
}

void vert(){
	for(int i = 0;i < n;i++){
		for(int j = 0;j < n;j++){
			if(ans[j][i] == 'V'){
				res[j][i] = 1;
				break;
			}
		}
	}
}

signed main(){ios::sync_with_stdio(false);cin.tie(0);	
	cin>>n;
	for(int i = 0;i < n;i++)ans[i] = string(n, '$');
	
	int x = ask(0, 0, 0, 1);
	if(x == 2 * n)ans[0][0] = ans[0][1] = 'V';
	else if(x == n)ans[0][0] = ans[0][1] = 'H';
	else{
		x = ask(0, 0, 0, 2);
		if(x == 2 * n)ans[0][0] = ans[0][2] = 'V', ans[0][1] = 'H';
		else if(x == n)ans[0][0] = ans[0][2] = 'H', ans[0][1] = 'V';
		else{
			x = ask(0, 1, 0, 2);
			if(x == 2 * n)ans[0][1] = ans[0][2] = 'V', ans[0][0] = 'H';
			else if(x == n)ans[0][1] = ans[0][2] = 'H', ans[0][0] = 'V';
		}
	}
	for(int i = 0;i < n;i++){
		for(int j = 0;j < n;j++){
			find(i, j);
		}
	}
	bool h = 1;
	for(int i = 0;i < n;i++){
		bool b = 0;
		for(int j = 0;j < n;j++){
			if(ans[i][j] == 'H'){
				b = 1;
				break;
			}
		}
		if(!b){
			h = 0;
			break;
		}
	}
	if(h)hor();
	else vert();
	cout<<"!"<<endl;
	for(int i = 0;i < n;i++){
		for(int j = 0;j < n;j++){
			cout<<res[i][j];
		}
		cout<<endl;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 340 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 352 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 1 ms 344 KB Output is correct
26 Correct 1 ms 344 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 1 ms 344 KB Output is correct
29 Correct 1 ms 344 KB Output is correct
30 Correct 1 ms 344 KB Output is correct
31 Correct 1 ms 344 KB Output is correct
32 Correct 1 ms 344 KB Output is correct
33 Correct 1 ms 344 KB Output is correct
34 Correct 1 ms 344 KB Output is correct
35 Correct 1 ms 344 KB Output is correct
36 Correct 1 ms 344 KB Output is correct
37 Correct 1 ms 344 KB Output is correct
38 Correct 1 ms 344 KB Output is correct
39 Correct 1 ms 344 KB Output is correct
40 Correct 1 ms 344 KB Output is correct
41 Correct 1 ms 344 KB Output is correct
42 Correct 1 ms 344 KB Output is correct
43 Correct 1 ms 344 KB Output is correct
44 Correct 1 ms 344 KB Output is correct
45 Correct 1 ms 344 KB Output is correct
46 Correct 1 ms 344 KB Output is correct
47 Correct 1 ms 344 KB Output is correct
48 Correct 0 ms 344 KB Output is correct
49 Correct 1 ms 344 KB Output is correct
50 Correct 0 ms 344 KB Output is correct
51 Correct 1 ms 344 KB Output is correct
52 Correct 1 ms 344 KB Output is correct
53 Correct 1 ms 344 KB Output is correct
54 Correct 1 ms 344 KB Output is correct
55 Correct 1 ms 344 KB Output is correct
56 Correct 1 ms 344 KB Output is correct
57 Correct 1 ms 344 KB Output is correct
58 Correct 1 ms 344 KB Output is correct
59 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Partially correct 1 ms 344 KB Partially correct
19 Partially correct 1 ms 344 KB Partially correct
20 Partially correct 1 ms 344 KB Partially correct
21 Partially correct 1 ms 344 KB Partially correct
22 Partially correct 1 ms 344 KB Partially correct
23 Partially correct 1 ms 344 KB Partially correct
24 Correct 0 ms 344 KB Output is correct
25 Partially correct 1 ms 344 KB Partially correct
26 Correct 1 ms 344 KB Output is correct
27 Partially correct 1 ms 344 KB Partially correct
28 Partially correct 1 ms 344 KB Partially correct
29 Partially correct 1 ms 344 KB Partially correct
30 Partially correct 1 ms 344 KB Partially correct
31 Partially correct 1 ms 344 KB Partially correct
32 Partially correct 1 ms 344 KB Partially correct
33 Partially correct 1 ms 344 KB Partially correct
34 Partially correct 1 ms 340 KB Partially correct
35 Partially correct 1 ms 344 KB Partially correct
36 Partially correct 1 ms 344 KB Partially correct
37 Partially correct 1 ms 344 KB Partially correct
38 Partially correct 1 ms 344 KB Partially correct
39 Partially correct 1 ms 344 KB Partially correct
40 Partially correct 1 ms 344 KB Partially correct
41 Partially correct 1 ms 344 KB Partially correct
42 Partially correct 1 ms 344 KB Partially correct
43 Partially correct 1 ms 344 KB Partially correct
44 Partially correct 1 ms 344 KB Partially correct
45 Partially correct 1 ms 344 KB Partially correct
46 Correct 1 ms 344 KB Output is correct
47 Correct 1 ms 344 KB Output is correct
48 Correct 0 ms 344 KB Output is correct
49 Correct 1 ms 344 KB Output is correct
50 Correct 0 ms 344 KB Output is correct
51 Correct 0 ms 344 KB Output is correct
52 Partially correct 1 ms 344 KB Partially correct
53 Partially correct 1 ms 344 KB Partially correct
54 Partially correct 1 ms 344 KB Partially correct
55 Partially correct 1 ms 344 KB Partially correct
56 Partially correct 1 ms 344 KB Partially correct
57 Partially correct 1 ms 344 KB Partially correct
58 Partially correct 1 ms 344 KB Partially correct
59 Runtime error 60 ms 716 KB Execution killed with signal 13
60 Halted 0 ms 0 KB -