Submission #75816282
Source Code Expand
#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
#define rep(i, s, e) for (ll i = (s); i <= (e); i++)
#define all(v) v.begin(), v.end()
#define pb push_back
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = array<ll, 2>;
ll T, n, a[101010];
string s;
int main() {
cin.tie(0)->sync_with_stdio(0);
cin >> T;
for (; T--;) {
cin >> n >> s;
fill(a, a + n, 2);
rep(i, 0, n - 1) {
ll l = (i + n - 1) % n, ll = (i + n - 2) % n, r = (i + 1) % n, rr = (i + 2) % n;
if (s[l] == s[ll] || s[r] == s[rr] || s[l] == s[r]) {
a[i] = 1;
}
}
rep(i, 0, n - 1) cout << a[i] << ' ';
cout << '\n';
}
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | J - DETOX |
| User | iAi |
| Language | C++23 (GCC 15.2.0) |
| Score | 100 |
| Code Size | 724 Byte |
| Status | AC |
| Exec Time | 16 ms |
| Memory | 4644 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 100 / 100 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00-sample-001.txt |
| All | 00-sample-001.txt, 01-002.txt, 01-003.txt, 01-004.txt, 01-005.txt, 01-006.txt, 01-007.txt, 01-008.txt, 01-009.txt, 01-010.txt, 01-011.txt, 01-012.txt, 01-013.txt, 01-014.txt, 01-015.txt, 01-016.txt, 01-017.txt, 01-018.txt, 01-019.txt, 01-020.txt, 01-021.txt, 01-022.txt, 01-023.txt, 01-024.txt, 01-025.txt, 01-026.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00-sample-001.txt | AC | 1 ms | 3524 KiB |
| 01-002.txt | AC | 16 ms | 3692 KiB |
| 01-003.txt | AC | 14 ms | 3580 KiB |
| 01-004.txt | AC | 14 ms | 3652 KiB |
| 01-005.txt | AC | 14 ms | 3620 KiB |
| 01-006.txt | AC | 14 ms | 3580 KiB |
| 01-007.txt | AC | 14 ms | 3524 KiB |
| 01-008.txt | AC | 13 ms | 3748 KiB |
| 01-009.txt | AC | 13 ms | 3596 KiB |
| 01-010.txt | AC | 13 ms | 3708 KiB |
| 01-011.txt | AC | 13 ms | 3604 KiB |
| 01-012.txt | AC | 13 ms | 3708 KiB |
| 01-013.txt | AC | 13 ms | 4248 KiB |
| 01-014.txt | AC | 14 ms | 4464 KiB |
| 01-015.txt | AC | 13 ms | 4588 KiB |
| 01-016.txt | AC | 14 ms | 4500 KiB |
| 01-017.txt | AC | 14 ms | 4644 KiB |
| 01-018.txt | AC | 14 ms | 4604 KiB |
| 01-019.txt | AC | 14 ms | 4492 KiB |
| 01-020.txt | AC | 14 ms | 4548 KiB |
| 01-021.txt | AC | 14 ms | 4588 KiB |
| 01-022.txt | AC | 14 ms | 4464 KiB |
| 01-023.txt | AC | 14 ms | 4584 KiB |
| 01-024.txt | AC | 14 ms | 4644 KiB |
| 01-025.txt | AC | 14 ms | 4500 KiB |
| 01-026.txt | AC | 15 ms | 4644 KiB |