Submission #466001

# Submission time Handle Problem Language Result Execution time Memory
466001 2021-08-17T13:32:02 Z Sench2006 Game (eJOI20_game) C++14
0 / 100
1 ms 204 KB
#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 time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 0 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 0 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -