Submission #70322049
Source Code Expand
Copy
#include <stdio.h>#include <stdlib.h>char S[24][212345];int ec[212345], *es[212345];int main(void) {int T, tc;if (scanf("%d", &T) != 1) return 1;for (tc = 0; tc < T; tc++) {int N, M, K;int i, j, k;if (scanf("%d%d%d", &N, &M, &K) != 3) return 1;if (scanf("%212343s", S[0] + 1) != 1) return 1;for (i = 0; i < M; i++) {int U, V;if (scanf("%d%d", &U, &V) != 2) return 1;es[U] = realloc(es[U], sizeof(*es[U]) * (ec[U] + 1));if (es[U] == NULL) return 2;es[U][ec[U]++] = V;
#include <stdio.h>
#include <stdlib.h>
char S[24][212345];
int ec[212345], *es[212345];
int main(void) {
int T, tc;
if (scanf("%d", &T) != 1) return 1;
for (tc = 0; tc < T; tc++) {
int N, M, K;
int i, j, k;
if (scanf("%d%d%d", &N, &M, &K) != 3) return 1;
if (scanf("%212343s", S[0] + 1) != 1) return 1;
for (i = 0; i < M; i++) {
int U, V;
if (scanf("%d%d", &U, &V) != 2) return 1;
es[U] = realloc(es[U], sizeof(*es[U]) * (ec[U] + 1));
if (es[U] == NULL) return 2;
es[U][ec[U]++] = V;
}
for (i = 1; i <= K * 2; i++) {
for (j = 1; j <= N; j++) {
char target = "AB"[i % 2], result = "BA"[i % 2];
for (k = 0; k < ec[j]; k++) {
if (S[i - 1][es[j][k]] == target) {
result = target;
break;
}
}
S[i][j] = result;
}
}
puts(S[K * 2][1] == 'B' ? "Bob" : "Alice");
for (i = 1; i <= N; i++) {
free(es[i]);
es[i] = NULL;
ec[i] = 0;
}
}
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | D - The Simple Game |
| User | mikecat |
| Language | C (gcc 12.2.0) |
| Score | 425 |
| Code Size | 976 Byte |
| Status | AC |
| Exec Time | 72 ms |
| Memory | 13936 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 425 / 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 | 1 ms | 1632 KiB |
| testcase00.txt | AC | 21 ms | 1708 KiB |
| testcase01.txt | AC | 24 ms | 1664 KiB |
| testcase02.txt | AC | 23 ms | 1764 KiB |
| testcase03.txt | AC | 24 ms | 1764 KiB |
| testcase04.txt | AC | 23 ms | 1788 KiB |
| testcase05.txt | AC | 67 ms | 13936 KiB |
| testcase06.txt | AC | 63 ms | 12852 KiB |
| testcase07.txt | AC | 72 ms | 12312 KiB |
| testcase08.txt | AC | 27 ms | 3052 KiB |
| testcase09.txt | AC | 27 ms | 3244 KiB |
| testcase10.txt | AC | 27 ms | 3188 KiB |
| testcase11.txt | AC | 35 ms | 3212 KiB |
| testcase12.txt | AC | 31 ms | 2608 KiB |
| testcase13.txt | AC | 29 ms | 2584 KiB |
| testcase14.txt | AC | 40 ms | 4180 KiB |
| testcase15.txt | AC | 48 ms | 5648 KiB |
| testcase16.txt | AC | 31 ms | 2760 KiB |
| testcase17.txt | AC | 25 ms | 2784 KiB |
| testcase18.txt | AC | 61 ms | 7776 KiB |
| testcase19.txt | AC | 50 ms | 5028 KiB |
| testcase20.txt | AC | 30 ms | 2704 KiB |
| testcase21.txt | AC | 32 ms | 2732 KiB |
| testcase22.txt | AC | 56 ms | 6148 KiB |