Submission #35538794
Source Code Expand
Copy
#include<bits/stdc++.h>using namespace std;#define int long long#define endl '\n'signed main(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);int T, n, k;string temp;cin >> T;while (T--){cin >> n >> k >> temp;int l = 0, r = 0;temp = "?" + temp;int pos = 0;for (int i = 1; i <= n; i++){
#include<bits/stdc++.h> using namespace std; #define int long long #define endl '\n' signed main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int T, n, k; string temp; cin >> T; while (T--) { cin >> n >> k >> temp; int l = 0, r = 0; temp = "?" + temp; int pos = 0; for (int i = 1; i <= n; i++) { if (temp[i] == '1') { pos = i; break; } } if (pos != 0) { l = pos; bool f = true; for (int i = n; i >= 1; i--) { if (temp[i] == '1') { r = i; break; } } for (int i = l; i <= r; i++) { if (temp[i] == '0') { f = false; break; } } if ((r - l + 1) > k)f = false; if (f && (r - l + 1) != k) { int ll = l, rr = r; for (int i = l - 1; i >= 1; i--) { if (temp[i] == '0')break; ll = i; } for (int i = r + 1; i <= n; i++) { if (temp[i] == '0')break; rr = i; } if ((rr - ll + 1) > k && ll != l && rr != r)f = false; if ((rr - ll + 1) < k)f = false; } if (f)cout << "Yes" << endl; else cout << "No" << endl; } else { bool f1 = true, f2 = true; for (int i = 1; i <= n; i++) { if (temp[i] == '?') { int last = i; while (1) { i++; if (temp[i] != '?')break; } if ((i - last + 1) == k)f1 = false; if ((i - last + 1) > k)f2 = false;; } } if (f1 || !f2)cout << "No" << endl; else cout << "Yes" << endl; } } return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Continuous 1 |
User | sjh |
Language | C++ (GCC 9.2.1) |
Score | 0 |
Code Size | 2366 Byte |
Status | WA |
Exec Time | 9 ms |
Memory | 3968 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00-sample-001.txt |
All | 00-sample-001.txt, 01-all-001.txt, 01-all-002.txt, 01-all-003.txt, 01-all-004.txt, 02-multi-001.txt, 02-multi-002.txt, 02-multi-003.txt, 02-multi-004.txt, 02-multi-005.txt, 02-multi-006.txt, 02-multi-007.txt, 02-multi-008.txt, 02-multi-009.txt, 02-multi-010.txt, 03-max-001.txt, 03-max-002.txt, 03-max-003.txt, 03-max-004.txt, 03-max-005.txt, 03-max-006.txt, 03-max-007.txt, 03-max-008.txt, 04-test-001.txt, 04-test-002.txt, 04-test-003.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00-sample-001.txt | AC | 6 ms | 3432 KB |
01-all-001.txt | WA | 6 ms | 3440 KB |
01-all-002.txt | WA | 7 ms | 3540 KB |
01-all-003.txt | WA | 6 ms | 3544 KB |
01-all-004.txt | WA | 9 ms | 3444 KB |
02-multi-001.txt | WA | 4 ms | 3628 KB |
02-multi-002.txt | WA | 6 ms | 3560 KB |
02-multi-003.txt | WA | 4 ms | 3496 KB |
02-multi-004.txt | WA | 4 ms | 3488 KB |
02-multi-005.txt | WA | 3 ms | 3604 KB |
02-multi-006.txt | WA | 3 ms | 3600 KB |
02-multi-007.txt | WA | 3 ms | 3600 KB |
02-multi-008.txt | WA | 3 ms | 3588 KB |
02-multi-009.txt | WA | 4 ms | 3576 KB |
02-multi-010.txt | WA | 4 ms | 3584 KB |
03-max-001.txt | AC | 3 ms | 3892 KB |
03-max-002.txt | AC | 5 ms | 3864 KB |
03-max-003.txt | WA | 7 ms | 3860 KB |
03-max-004.txt | AC | 5 ms | 3868 KB |
03-max-005.txt | AC | 7 ms | 3920 KB |
03-max-006.txt | AC | 3 ms | 3848 KB |
03-max-007.txt | AC | 4 ms | 3800 KB |
03-max-008.txt | AC | 4 ms | 3844 KB |
04-test-001.txt | AC | 5 ms | 3856 KB |
04-test-002.txt | AC | 4 ms | 3968 KB |
04-test-003.txt | AC | 4 ms | 3844 KB |