結果
| 問題 | No.3606 Ice Grid Game |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-07-31 22:35:43 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 64 ms / 2,000 ms |
| + 954µs | |
| コード長 | 1,653 bytes |
| 記録 | |
| コンパイル時間 | 2,121 ms |
| コンパイル使用メモリ | 341,348 KB |
| 実行使用メモリ | 42,624 KB |
| 最終ジャッジ日時 | 2026-07-31 22:35:47 |
| 合計ジャッジ時間 | 3,967 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 11 |
ソースコード
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,s,n) for (int i = (s); i < (n); ++i)
#define rrep(i,g,n) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define len(x) (int)(x).size()
#define dup(x,y) (((x)+(y)-1)/(y))
#define pb push_back
#define eb emplace_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using ull = unsigned long long;
template<typename T> using pq = priority_queue<T,vector<T>,greater<T>>;
using P = pair<int,int>;
template<class T>bool chmax(T&a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T&a,T b){if(b<a){a=b;return 1;}return 0;}
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
void solve() {
int h, w, r, c;
cin >> h >> w >> r >> c;
vector<string> s(h, string(w, '.'));
stack<P> stk;
function<bool(int,int)> f = [&](int x, int y) {
bool ret = 0;
rep(d,0,4) {
int nx = x+dx[d], ny = y+dy[d];
if (nx < 0 || nx >= h || ny < 0 || ny >= w) continue;
if (s[nx][ny] == '#') continue;
int cx = x, cy = y, cnt = 0;
while(0 <= cx+dx[d] && cx+dx[d] < h && 0 <= cy+dy[d] && cy+dy[d] < w && s[cx+dx[d]][cy+dy[d]] == '.') {
s[cx][cy] = '#';
stk.emplace(cx, cy);
++cnt;
cx += dx[d], cy += dy[d];
}
ret |= (f(cx, cy)^1);
while(cnt--) {
s[stk.top().fi][stk.top().se] = '.';
stk.pop();
}
}
return ret;
};
if (f(r-1, c-1)) {
cout << "Alice" << endl;
} else {
cout << "Bob" << endl;
}
}
int main() {
int t;
cin >> t;
while(t--) solve();
return 0;
}