# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
684964 |
2023-01-23T00:56:27 Z |
NK_ |
Furniture (JOI20_furniture) |
C++17 |
|
5000 ms |
214564 KB |
// Success consists of going from failure to failure without loss of enthusiasm
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
int main() {
cin.tie(0)->sync_with_stdio(0);
int N, M; cin >> N >> M;
vector<vector<int>> A(N, vector<int>(M)); for(auto &v : A) for(auto &x : v) cin >> x;
function<bool(int, int)> dfs = [&](int r, int c) -> bool {
if (r >= N || c >= M) return 0;
if (A[r][c]) return 0;
cout << r << " " << c << nl;
if (r == N-1 && c == M-1) return 1;
return dfs(r+1, c) || dfs(r, c+1);
};
int Q; cin >> Q;
for(int q = 0; q < Q; q++) {
int r, c; cin >> r >> c; --r, --c; A[r][c] = 1;
int res = dfs(0, 0);
cout << res << nl;
A[r][c] ^= !res;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5057 ms |
214564 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5057 ms |
214564 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |