Submission #75816784
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
// https://github.com/skrewbar/cp-templates
#define all(v) (v).begin(), (v).end()
#define compress(v) \
sort(all(v)); \
v.erase(unique(all(v)), (v).end())
#define by(x) [](const auto& a, const auto& b) { return a.x < b.x; }
#define by_desc(x) [](const auto& a, const auto& b) { return a.x > b.x; }
template <typename T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template <typename T>
bool minimize(T& target, T candidate) {
return target > candidate ? (target = candidate, true) : false;
}
template <typename T>
bool maximize(T& target, T candidate) {
return target < candidate ? (target = candidate, true) : false;
}
int N;
string S;
char getS(int i) {
return S[((i % N) + N) % N];
}
void solve() {
cin >> N;
cin >> S;
for (int i = 0; i < N; i++) {
if (getS(i - 2) == getS(i - 1)
or getS(i + 1) == getS(i + 2)
or getS(i - 1) == getS(i + 1))
cout << 1 << ' ';
else
cout << 2 << ' ';
}
cout << '\n';
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while (t--)
solve();
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | J - DETOX |
| User | skuru |
| Language | C++23 (GCC 15.2.0) |
| Score | 100 |
| Code Size | 1281 Byte |
| Status | AC |
| Exec Time | 15 ms |
| Memory | 3828 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 | 2 ms | 3512 KiB |
| 01-002.txt | AC | 15 ms | 3512 KiB |
| 01-003.txt | AC | 12 ms | 3512 KiB |
| 01-004.txt | AC | 12 ms | 3408 KiB |
| 01-005.txt | AC | 12 ms | 3552 KiB |
| 01-006.txt | AC | 12 ms | 3552 KiB |
| 01-007.txt | AC | 12 ms | 3468 KiB |
| 01-008.txt | AC | 11 ms | 3640 KiB |
| 01-009.txt | AC | 11 ms | 3700 KiB |
| 01-010.txt | AC | 11 ms | 3520 KiB |
| 01-011.txt | AC | 11 ms | 3512 KiB |
| 01-012.txt | AC | 11 ms | 3540 KiB |
| 01-013.txt | AC | 12 ms | 3632 KiB |
| 01-014.txt | AC | 11 ms | 3648 KiB |
| 01-015.txt | AC | 11 ms | 3824 KiB |
| 01-016.txt | AC | 11 ms | 3648 KiB |
| 01-017.txt | AC | 11 ms | 3828 KiB |
| 01-018.txt | AC | 11 ms | 3828 KiB |
| 01-019.txt | AC | 11 ms | 3668 KiB |
| 01-020.txt | AC | 12 ms | 3668 KiB |
| 01-021.txt | AC | 11 ms | 3648 KiB |
| 01-022.txt | AC | 11 ms | 3736 KiB |
| 01-023.txt | AC | 11 ms | 3672 KiB |
| 01-024.txt | AC | 11 ms | 3668 KiB |
| 01-025.txt | AC | 11 ms | 3648 KiB |
| 01-026.txt | AC | 12 ms | 3692 KiB |