?
# | Author | Problem | Lang | Verdict | Time | Memory | Sent | Judged | |
---|---|---|---|---|---|---|---|---|---|
111586492 |
Practice: IcantComeUpWithOrigName |
1206E - 33 | GNU C++14 | Wrong answer on test 1 | 15 ms | 0 KB | 2021-03-31 21:05:12 | 2021-03-31 21:05:12 |
#include <iostream> #include <iostream> #include <ostream> #include <numeric> #include <string> #include <list> #include <functional> #include <vector> #include <map> #include <set> #include <stack> #include <queue> #include <ios> #include <cmath> #include <algorithm> #include <fstream> #include <iomanip> #include <unordered_map> using namespace std; #define READ(t) ll t; cin >> t; #define PRINT(t) cout << t << endl #define vool vector<bool> #define vint vector<int> #define vong vector<long long> #define var vector<char> #define ving vector<string> #define sint set<int> #define song set<long long> #define sar set<char> #define sing set<string> #define mint set<int> #define mong set<long long> #define mar set<char> #define ll long long #define ull unsigned long long #define ld long double #define db double #define EXIST(x, s) s.find(x) != s.end() #define rep(i, a, b) for (ll i = (a); i <= ll(b); i++) // Varibales template <class Temp> vector<Temp> read(ll n){ vector<Temp> v(n); for(int i = 0; i < n; i++){ cin >> v[i]; } return v; } template <class Temp> void print(vong &v){ for(Temp el: v){ cout << el << " "; } cout << endl; } template <class Temp> vector<vector<Temp>> matrix(ll n, ll m, ll value){ return vector<vector<Temp>>(n, vector<Temp>(m)); } template <class Temp> vector<vector<Temp>> readMatrix(ll n, ll m){ vector<vector<Temp>> matrix(n, vector<ll>(m, 0)); for(ll i = 0; i < n; i++){ for(ll j = 0; j < m; j++){ cin >> matrix[i][j]; } } return matrix; } void solve(){ ll n; cin >> n; auto mat = matrix<bool>(n, n, 0); mat[0][0] = 1; mat[n-1][n-1] = 0; for(ll i = 0; i < n; i++){ for(ll j = 0; j < n; j++){ if(i == 0 and j < 2){ continue; } if(i == n-1 and j == n-1){ continue; } if(i - 2 >= 0){ cout << "? "<< i - 2 + 1 << " " << j + 1 << " " << i + 1 << " " << j + 1 << endl; //cout.flush(); ll resp; cin >> resp; if(resp){ mat[i][j] = mat[i-2][j]; }else{ mat[i][j] = !mat[i-2][j]; } }else if(j - 2 >= 0){ cout << "? "<< i + 1 << " " << j - 2 + 1 << " " << i + 1 << " " << j + 1 << endl; //cout.flush(); ll resp; cin >> resp; if(resp){ mat[i][j] = mat[i][j-2]; }else{ mat[i][j] = !mat[i][j-2]; } }else if(i - 1 >= 0 and j - 1 >= 0){ cout << "? "<< i << " " << j << " " << i + 1 << " " << j + 1 << endl; //cout.flush(); ll resp; cin >> resp; if(resp){ mat[i][j] = mat[i-1][j-1]; }else{ mat[i][j] = !mat[i-1][j-1]; } }else if(i - 1 >= 0 and j + 1 < n){ cout << "? "<< i << " " << j + 2 << " " << i + 1 << " " << j + 1 << endl; //cout.flush(); ll resp; cin >> resp; if(resp){ mat[i][j] = mat[i-1][j+1]; }else{ mat[i][j] = !mat[i-1][j+1]; } } } } cout << "? 1 1 2 3" << endl; //cout.flush(); bool myxor; ll resp; cin >> resp; if(resp){ myxor = mat[0][0] != mat[1][2]; } cout << "? 1 1 3 2" << endl; //cout.flush(); cin >> resp; if(resp){ myxor = mat[0][0] != mat[2][1]; } cout << "? 1 2 3 3" << endl; //cout.flush(); cin >> resp; if(resp){ myxor = mat[0][1] != mat[2][2]; } cout << "!" << "\n"; //cout.flush(); for(ll i = 0; i < n; i++){ for(ll j = 0; j < n; j++){ if((i + j) % 2){ if(myxor){ mat[i][j] = !mat[i][j]; } } cout << mat[i][j]; } cout << endl; //flush; } } void test(){ ll T; cin >> T; for(ll t = 1; t <= T; t++){ solve(); } } int main() { solve(); } // 1 1 1 // 2 3 1 1 // 3 6 1 1 // 4 10 1 1 // 1 0 1 // 0 1 1 // 0 1 0
?
?
?
?