题解:CF1906C Cursed Game
为什么有 *3000?
对于
对于
所以期望花费
(而且说这样一个题为啥要放 100+ 个测试点啊)
#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(time(0));
int n, a[500][500], b[500][500];
void solve(){
cin >> n;
if(n == 3){
while(true){
for(int i = 1; i <= 3; i++){
for(int j = 1; j <= 3; j++)
cout << (rnd() & 1);
cout << "\n";
}
cout << flush;
string s;
cin >> s;
if(s == "CORRECT") return ;
else cin >> s;
}
return ;
}
for(int i = 1; i <= n; i++){
for(int j = 1; j <= n; j++)
cout << (i == 3 && j == 3);
cout << "\n";
}
cout << flush;
string s;
cin >> s;
if(s == "CORRECT") return ;
for(int i = 1; i <= 3; i++)
for(int j = 1; j <= 3; j++)
a[i][j] = 0;
for(int i = 1; i <= n - 2; i++)
for(int j = 1; j <= n - 2; j++){
char x; cin >> x;
if(i <= 3 && j <= 3)
a[4 - i][4 - j] = x - '0';
}
for(int i = 1; i <= n; i++) for(int j = 1; j <= n; j++)
b[i][j] = -1;
for(int i = 1; i <= n - 2; i++)
for(int j = 1; j <= n - 2; j++){
int sum = 0;
for(int x = 1; x <= 3; x++)
for(int y = 1; y <= 3; y++)
if(a[x][y] && b[i + x - 1][j + y - 1] != -1)
sum ^= b[i + x - 1][j + y - 1];
for(int x = 1; x <= 3; x++)
for(int y = 1; y <= 3; y++)
if(a[x][y] && b[i + x - 1][j + y - 1] == -1){
if(!sum) b[i + x - 1][j + y - 1] = 1, sum = 1;
else b[i + x - 1][j + y - 1] = 0;
}
}
for(int i = 1; i <= n; i++){
for(int j = 1; j <= n; j++)
cout << max(0, b[i][j]);
cout << "\n";
}
cout << flush;
cin >> s;
return ;
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int T = 333;
while(T--) solve();
return 0;
}