Submission #70064423
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define MOD 100007
#define N 1000005
vector<int> g[1005];
int dp[1005][105];
signed main()
{
// freopen(".in","r",stdin);
// freopen(".out","w",stdout);
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int T;
cin>>T;
while(T--)
{
int n,m,k;
cin>>n>>m>>k;
string s;
cin>>s;
for(int i=0;i<m;i++)
{
int u,v;
cin>>u>>v;
g[u].push_back(v);
}
memset(dp,0,sizeof(dp));
for(int i=1;i<=n;i++) dp[i][0]=s[i-1]=='A';
for(int d=1;d<=k;d++){
for(int u=1;u<=n;u++){
int p=(k-d)%2==0?0:1;
if(p==0){
dp[u][d]=0;
for(int v:g[u]) if(dp[v][d-1]){dp[u][d]=1;break;}
}else{
dp[u][d]=1;
for(int v:g[u]) if(!dp[v][d-1]){dp[u][d]=0;break;}
}
}
}
cout<<(dp[1][k]?"Bob\n":"Alice\n");
}
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | D - The Simple Game |
| User | czjiaa |
| Language | C++ 20 (gcc 12.2) |
| Score | 0 |
| Code Size | 1123 Byte |
| Status | RE |
| Exec Time | 2207 ms |
| Memory | 6324 KiB |
Judge Result
| Set Name | Sample | All | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 425 | ||||||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample00.txt |
| All | sample00.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt, testcase05.txt, testcase06.txt, testcase07.txt, testcase08.txt, testcase09.txt, testcase10.txt, testcase11.txt, testcase12.txt, testcase13.txt, testcase14.txt, testcase15.txt, testcase16.txt, testcase17.txt, testcase18.txt, testcase19.txt, testcase20.txt, testcase21.txt, testcase22.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| sample00.txt | AC | 2 ms | 4236 KiB |
| testcase00.txt | TLE | 2207 ms | 5248 KiB |
| testcase01.txt | WA | 373 ms | 6092 KiB |
| testcase02.txt | WA | 56 ms | 6324 KiB |
| testcase03.txt | WA | 362 ms | 6192 KiB |
| testcase04.txt | WA | 59 ms | 6308 KiB |
| testcase05.txt | RE | 86 ms | 3524 KiB |
| testcase06.txt | RE | 87 ms | 3508 KiB |
| testcase07.txt | RE | 87 ms | 3528 KiB |
| testcase08.txt | WA | 18 ms | 5840 KiB |
| testcase09.txt | WA | 18 ms | 5868 KiB |
| testcase10.txt | WA | 18 ms | 6032 KiB |
| testcase11.txt | RE | 84 ms | 3196 KiB |
| testcase12.txt | RE | 85 ms | 3288 KiB |
| testcase13.txt | RE | 85 ms | 3128 KiB |
| testcase14.txt | RE | 85 ms | 3288 KiB |
| testcase15.txt | RE | 85 ms | 3316 KiB |
| testcase16.txt | RE | 86 ms | 3212 KiB |
| testcase17.txt | AC | 16 ms | 6160 KiB |
| testcase18.txt | RE | 85 ms | 3280 KiB |
| testcase19.txt | RE | 84 ms | 3400 KiB |
| testcase20.txt | RE | 84 ms | 3228 KiB |
| testcase21.txt | RE | 86 ms | 3212 KiB |
| testcase22.txt | RE | 87 ms | 3312 KiB |