Submission #75815051


Source Code Expand

#include <bits/stdc++.h>
#define S 5050
using namespace std;
typedef long long ll;

ll ans[300030];
ll n;
string s;

ll soo(ll x)
{
    return (x+n)%n;
}

void solve()
{
    cin>>n;
    cin>>s;
    for (ll i=0;i<n;i++)
    {
        ll dab=2;
        if (s[soo(i+1)]==s[soo(i+2)]) dab=1;
        if (s[soo(i-1)]==s[soo(i-2)]) dab=1;
        if (s[soo(i+1)]==s[soo(i-1)]) dab=1;
        ans[i]=dab;
    }
    for (ll i=0;i<n;i++) cout<<ans[i]<<" ";
    cout<<"\n";
}

int main()
{
    ll tc;
    cin>>tc;
    while (tc--) solve();
}

Submission Info

Submission Time
Task J - DETOX
User prologue1017
Language C++23 (GCC 15.2.0)
Score 100
Code Size 568 Byte
Status AC
Exec Time 63 ms
Memory 4588 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 1
AC × 26
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 3528 KiB
01-002.txt AC 63 ms 3528 KiB
01-003.txt AC 19 ms 3536 KiB
01-004.txt AC 19 ms 3492 KiB
01-005.txt AC 19 ms 3528 KiB
01-006.txt AC 19 ms 3492 KiB
01-007.txt AC 19 ms 3536 KiB
01-008.txt AC 17 ms 3724 KiB
01-009.txt AC 16 ms 3624 KiB
01-010.txt AC 16 ms 3656 KiB
01-011.txt AC 16 ms 3392 KiB
01-012.txt AC 17 ms 3704 KiB
01-013.txt AC 17 ms 4160 KiB
01-014.txt AC 16 ms 4424 KiB
01-015.txt AC 17 ms 4468 KiB
01-016.txt AC 17 ms 4552 KiB
01-017.txt AC 16 ms 4556 KiB
01-018.txt AC 17 ms 4520 KiB
01-019.txt AC 16 ms 4424 KiB
01-020.txt AC 17 ms 4520 KiB
01-021.txt AC 16 ms 4472 KiB
01-022.txt AC 17 ms 4588 KiB
01-023.txt AC 16 ms 4576 KiB
01-024.txt AC 17 ms 4552 KiB
01-025.txt AC 17 ms 4552 KiB
01-026.txt AC 41 ms 4520 KiB