Submission #466001

#TimeUsernameProblemLanguageResultExecution timeMemory
466001Sench2006Game (eJOI20_game)C++14
0 / 100
1 ms204 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define ar array #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define lb lower_bound #define ub upper_bound #define FOR(i, a, b) for(auto i = a; i < b; i++) #define FORD(i, a, b) for(auto i = a - 1; i >= b; i--) #define trav(x, v) for(auto x : v) #define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); // ---------------------------------------- Solution ---------------------------------------- // const int N = 25; int n, m; int a[N][N]; int b[N][N]; void solve() { cin >> n >> m; FOR(i, 0, n + 1) { FOR(j, 0, m) { cin >> a[i][j]; } } FOR(i, 0, n) { FOR(j, 0, m + 1) { cin >> b[i][j]; } } FOR(i, 0, n) { FOR(j, 0, m) { if (a[i][j] && a[i + 1][j] && b[i][j] && b[i][j + 1]) continue; else { int x = 0; if (!a[i][j]) x++; if (!a[i + 1][j]) x++; if (!b[i][j]) x++; if (!b[i][j + 1]) x++; if (x == 0) { cout << 0 << "\n"; return; } else { cout << -1 << "\n"; return; } } } } } int main() { fastio; int tests = 1; // cin >> tests; while (tests--) { solve(); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...