Submission #1140590

#TimeUsernameProblemLanguageResultExecution timeMemory
1140590browntoadFurniture (JOI20_furniture)C++20
5 / 100
5091 ms2396 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define int ll #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) FOR(i, 0, n) #define REP1(i, n) FOR(i, 1, n+1) #define pii pair<int, int> #define f first #define s second #define ALL(x) (x).begin(), (x).end() #define SZ(x) (int)((x).size()) #define pb push_back #define endl '\n' #define IOS() ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); const ll maxn = 1005; const ll inf = 1ll<<60; const ll mod = 1e9+7; int n, m; bool arr[maxn][maxn]; bool ok[maxn][maxn]; bool run(){ REP1(i, n){ REP1(j, m){ ok[i][j] = (ok[i-1][j] | ok[i][j-1]); ok[1][1] = 1; if (arr[i][j]) ok[i][j] = 0; } } return ok[n][m]; } signed main(){ IOS(); cin>>n>>m; REP1(i, n){ REP1(j, m){ cin>>arr[i][j]; } } int q; cin>>q; while(q--){ int a, b; cin>>a>>b; arr[a][b] = 1; bool ret = run(); cout<<ret<<endl; if (ret == 0){ arr[a][b] = 0; } } } /* 7 WBBWWWBBBBWBWW */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...