結果
| 問題 | No.3606 Ice Grid Game |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-07-31 21:52:31 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 263 ms / 2,000 ms |
| + 649µs | |
| コード長 | 952 bytes |
| 記録 | |
| コンパイル時間 | 1,510 ms |
| コンパイル使用メモリ | 186,832 KB |
| 実行使用メモリ | 198,528 KB |
| 最終ジャッジ日時 | 2026-07-31 21:52:39 |
| 合計ジャッジ時間 | 3,834 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 11 |
ソースコード
#include <iostream>
#include <ranges>
#include <algorithm>
#include <vector>
using namespace std;
using ll=long long;
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int ttt;
cin>>ttt;
while(ttt--){
int h,w,r,c;
cin>>h>>w>>r>>c;
r--;c--;
vector<vector<bool>> grid(h,vector<bool>(w));
vector<int> dx={1,0,-1,0},dy={0,1,0,-1};
auto dfs=[&](auto dfs,int x,int y,int d)->bool{
if(d!=-1){
int nx=x+dx[d],ny=y+dy[d];
if(0<=nx&&nx<h&&0<=ny&&ny<w&&grid[nx][ny]==false){
grid[nx][ny]=true;
bool res=dfs(dfs,nx,ny,d);
grid[nx][ny]=false;
return res;
}
}
bool res=false;
for(int r=0;r<4;r++){
int nx=x+dx[r],ny=y+dy[r];
if(0<=nx&&nx<h&&0<=ny&&ny<w&&grid[nx][ny]==false){
grid[nx][ny]=true;
if(!dfs(dfs,nx,ny,r))res=true;
grid[nx][ny]=false;
}
}
return res;
};
grid[r][c]=true;
if(dfs(dfs,r,c,-1))cout<<"Alice"<<endl;
else cout<<"Bob"<<endl;
}
}