Submission #68020303
Source Code Expand
Copy
#include <stdio.h>int getnum(void) {char buf[32];int res;if (fgets(buf, sizeof(buf), stdin) == NULL) return -1;if (sscanf(buf, "%d", &res) != 1) return -1;return res;}int N;char S[(1 << 18) + 222];int visited[(1 << 18) + 222];int q[(1 << 18) + 222];int main(void) {int T, tc;T = getnum();if (T < 0) return 1;for (tc = 1; tc <= T; tc++) {
#include <stdio.h> int getnum(void) { char buf[32]; int res; if (fgets(buf, sizeof(buf), stdin) == NULL) return -1; if (sscanf(buf, "%d", &res) != 1) return -1; return res; } int N; char S[(1 << 18) + 222]; int visited[(1 << 18) + 222]; int q[(1 << 18) + 222]; int main(void) { int T, tc; T = getnum(); if (T < 0) return 1; for (tc = 1; tc <= T; tc++) { int qs = 0, qe = 0; N = getnum(); if (N < 0) return 1; if (fgets(S + 1, sizeof(S) - 1, stdin) == NULL) return 1; visited[0] = tc; q[qe++] = 0; while (qs < qe) { int cur = q[qs++]; int i; for (i = 0; i < N; i++) { int next = cur | (1 << i); if (S[next] != '1' && visited[next] != tc) { visited[next] = tc; q[qe++] = next; } } } puts(visited[(1 << N) - 1] == tc ? "Yes" : "No"); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Mixture |
User | mikecat |
Language | C (gcc 12.2.0) |
Score | 350 |
Code Size | 854 Byte |
Status | AC |
Exec Time | 20 ms |
Memory | 3920 KiB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 350 / 350 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt |
All | sample_01.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 0 ms | 1508 KiB |
test_01.txt | AC | 5 ms | 1660 KiB |
test_02.txt | AC | 6 ms | 1664 KiB |
test_03.txt | AC | 7 ms | 1696 KiB |
test_04.txt | AC | 8 ms | 1668 KiB |
test_05.txt | AC | 20 ms | 3376 KiB |
test_06.txt | AC | 8 ms | 1628 KiB |
test_07.txt | AC | 7 ms | 2624 KiB |
test_08.txt | AC | 8 ms | 1664 KiB |
test_09.txt | AC | 13 ms | 3872 KiB |
test_10.txt | AC | 8 ms | 1584 KiB |
test_11.txt | AC | 11 ms | 3884 KiB |
test_12.txt | AC | 8 ms | 1620 KiB |
test_13.txt | AC | 5 ms | 2464 KiB |
test_14.txt | AC | 3 ms | 1632 KiB |
test_15.txt | AC | 8 ms | 2424 KiB |
test_16.txt | AC | 4 ms | 1660 KiB |
test_17.txt | AC | 14 ms | 3464 KiB |
test_18.txt | AC | 6 ms | 1692 KiB |
test_19.txt | AC | 5 ms | 2300 KiB |
test_20.txt | AC | 8 ms | 1624 KiB |
test_21.txt | AC | 1 ms | 1992 KiB |
test_22.txt | AC | 6 ms | 1624 KiB |
test_23.txt | AC | 7 ms | 3920 KiB |
test_24.txt | AC | 5 ms | 1584 KiB |