QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#691122#7656. EszettVanLam#AC ✓1ms3716kbC++142.4kb2024-10-31 10:00:012024-10-31 10:00:02

Judging History

你现在查看的是最新测评结果

  • [2024-10-31 10:00:02]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3716kb
  • [2024-10-31 10:00:01]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define fi first
#define se second
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vs vector<string>
#define pii pair<int, int>
#define pib pair<int, bool>
#define pdd pair<double, double>
#define mii map<int, int>
#define mib map<int, bool>
#define mil map<int, ll>
#define mli map<ll, int>
#define si set<int>
#define vvi vector<vi>
#define vvl vector<vl>
#define vvb vector<vb>
#define vpi vector<pii>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sub(x, l, r) (x).begin() + l, (x).begin() + r
#define rsub(x, l, r) (x).rbegin() + l, (x).rbegin() + r
#define FOR(i, a, b) for (int i = a, _b = b; i <= _b; i++)
#define FORD(i, a, b) for (int i = a, _b = b; i >= _b; i--)

#define yes cout << "YES\n";
#define no cout << "NO\n";
#define yn yes else no
#define ny no else yes

// #define int ll

#ifdef VanLam
#include <debug.h>
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 1205
#endif

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int maxN = 1e6 + 5;

vb isChanged;
string s;
int n;

void get()
{
    FOR(i, 0, n - 1)
    {
        if (isChanged[i])
        {
            cout << 'B';
            i++;
        }
        else
        {
            cout << s[i];
        }
    }
    cout << '\n';
}

void backTrack(int k, int num)
{

    if (num >= 2)
    {
        isChanged[k - 2] = true;
        backTrack(k + 1, num - 2);
        isChanged[k - 2] = false;
    }
    if (k >= n)
    {
        get();
        return;
    }

    if (s[k] == 's')
    {
        backTrack(k + 1, num + 1);
    }
    else
    {
        backTrack(k + 1, 0);
    }
}

void solve()
{
    cin >> s;
    n = s.length();
    FOR(i, 0, n - 1)
    s[i] = tolower(s[i]);

    isChanged.assign(n, 0);
    backTrack(0, 0);
}

signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    if (fopen("input.txt", "r"))
    {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    }

    int t = 1;
    // cin >> t;
    int testcase = 1;
    while (t--)
    {
        cerr << "------ CASE: " << testcase++ << " ------\n";
        solve();
        cerr << "-------- END --------\n";
    }
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3656kb

input:

AUFREISSEN

output:

aufreiBen
aufreissen

result:

ok correct

Test #2:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

MASSSTAB

output:

maBstab
masBtab
massstab

result:

ok correct

Test #3:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

EINDEUTIG

output:

eindeutig

result:

ok correct

Test #4:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

S

output:

s

result:

ok correct

Test #5:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

STRASSE

output:

straBe
strasse

result:

ok correct

Test #6:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

M

output:

m

result:

ok correct

Test #7:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

MZ

output:

mz

result:

ok correct

Test #8:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

SE

output:

se

result:

ok correct

Test #9:

score: 0
Accepted
time: 0ms
memory: 3704kb

input:

BS

output:

bs

result:

ok correct

Test #10:

score: 0
Accepted
time: 0ms
memory: 3716kb

input:

SS

output:

B
ss

result:

ok correct

Test #11:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

MZN

output:

mzn

result:

ok correct

Test #12:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

SET

output:

set

result:

ok correct

Test #13:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

BSC

output:

bsc

result:

ok correct

Test #14:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

SSH

output:

Bh
ssh

result:

ok correct

Test #15:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

HJS

output:

hjs

result:

ok correct

Test #16:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

SUS

output:

sus

result:

ok correct

Test #17:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

TSS

output:

tB
tss

result:

ok correct

Test #18:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

SSS

output:

Bs
sB
sss

result:

ok correct

Test #19:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

QSSS

output:

qBs
qsB
qsss

result:

ok correct

Test #20:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

CWSF

output:

cwsf

result:

ok correct

Test #21:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

SKMS

output:

skms

result:

ok correct

Test #22:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

SSOSY

output:

Bosy
ssosy

result:

ok correct

Test #23:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

SJTJS

output:

sjtjs

result:

ok correct

Test #24:

score: 0
Accepted
time: 0ms
memory: 3708kb

input:

KFQSS

output:

kfqB
kfqss

result:

ok correct

Test #25:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

SSTBAS

output:

Btbas
sstbas

result:

ok correct

Test #26:

score: 0
Accepted
time: 0ms
memory: 3572kb

input:

SEJWHS

output:

sejwhs

result:

ok correct

Test #27:

score: 0
Accepted
time: 0ms
memory: 3708kb

input:

VSSIVK

output:

vBivk
vssivk

result:

ok correct

Test #28:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

SISDRKS

output:

sisdrks

result:

ok correct

Test #29:

score: 0
Accepted
time: 0ms
memory: 3708kb

input:

SSIIYRU

output:

Biiyru
ssiiyru

result:

ok correct

Test #30:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

SVXSCSI

output:

svxscsi

result:

ok correct

Test #31:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

CSSUFKSA

output:

cBufksa
cssufksa

result:

ok correct

Test #32:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

XYCXSUJW

output:

xycxsujw

result:

ok correct

Test #33:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

SSCCVGSE

output:

Bccvgse
ssccvgse

result:

ok correct

Test #34:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

USODCFCQW

output:

usodcfcqw

result:

ok correct

Test #35:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

QSSYLGSUT

output:

qBylgsut
qssylgsut

result:

ok correct

Test #36:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

SFSWSZFVG

output:

sfswszfvg

result:

ok correct

Test #37:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

ZDIISSFQBK

output:

zdiiBfqbk
zdiissfqbk

result:

ok correct

Test #38:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

NASPGSYSLL

output:

naspgsysll

result:

ok correct

Test #39:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

TYSNSELISR

output:

tysnselisr

result:

ok correct

Test #40:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

SASIIFGXSPC

output:

sasiifgxspc

result:

ok correct

Test #41:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

BCSADCQJASS

output:

bcsadcqjaB
bcsadcqjass

result:

ok correct

Test #42:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

SQSPSUXEOBV

output:

sqspsuxeobv

result:

ok correct

Test #43:

score: 0
Accepted
time: 0ms
memory: 3624kb

input:

GSKRZGXGJSES

output:

gskrzgxgjses

result:

ok correct

Test #44:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

DSSCJYYFKSZQ

output:

dBcjyyfkszq
dsscjyyfkszq

result:

ok correct

Test #45:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

KLSZNDQRYSSK

output:

klszndqryBk
klszndqryssk

result:

ok correct

Test #46:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

QNYSSOIOHKSPP

output:

qnyBoiohkspp
qnyssoiohkspp

result:

ok correct

Test #47:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

KHFSGMSNZBSNA

output:

khfsgmsnzbsna

result:

ok correct

Test #48:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

YBSDSSCXQNYNW

output:

ybsdBcxqnynw
ybsdsscxqnynw

result:

ok correct

Test #49:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

POGSVOPOZWSSBX

output:

pogsvopozwBbx
pogsvopozwssbx

result:

ok correct

Test #50:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

BRGSUSVQWBYHSX

output:

brgsusvqwbyhsx

result:

ok correct

Test #51:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

XFTTSZJMJFMYST

output:

xfttszjmjfmyst

result:

ok correct

Test #52:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

PIRMPOSGPIMFBEK

output:

pirmposgpimfbek

result:

ok correct

Test #53:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

BHPGVKJMPQDSISS

output:

bhpgvkjmpqdsiB
bhpgvkjmpqdsiss

result:

ok correct

Test #54:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

EGLSNBNSLLVWVPS

output:

eglsnbnsllvwvps

result:

ok correct

Test #55:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

ACTSFNGHJSNWSJJP

output:

actsfnghjsnwsjjp

result:

ok correct

Test #56:

score: 0
Accepted
time: 0ms
memory: 3568kb

input:

QUSSADXNLLJHXFXS

output:

quBadxnlljhxfxs
qussadxnlljhxfxs

result:

ok correct

Test #57:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

RNEHZSVOPKIDSPJF

output:

rnehzsvopkidspjf

result:

ok correct

Test #58:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

RKXBCPXJSATTJMSSO

output:

rkxbcpxjsattjmBo
rkxbcpxjsattjmsso

result:

ok correct

Test #59:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

XKSZJJHSVSHUAHTCE

output:

xkszjjhsvshuahtce

result:

ok correct

Test #60:

score: 0
Accepted
time: 0ms
memory: 3576kb

input:

SNGJTDICCSWLRDVBN

output:

sngjtdiccswlrdvbn

result:

ok correct

Test #61:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

BLSDETWYSWXSGKNPMO

output:

blsdetwyswxsgknpmo

result:

ok correct

Test #62:

score: 0
Accepted
time: 0ms
memory: 3708kb

input:

STJSQRSZPNHVLKILRO

output:

stjsqrszpnhvlkilro

result:

ok correct

Test #63:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

XSGLLGSMLDISWNXPWA

output:

xsgllgsmldiswnxpwa

result:

ok correct

Test #64:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

UASUWWGCTGGSKSNWLJX

output:

uasuwwgctggsksnwljx

result:

ok correct

Test #65:

score: 0
Accepted
time: 0ms
memory: 3708kb

input:

LXAWDLZSCRNEXSGGSKB

output:

lxawdlzscrnexsggskb

result:

ok correct

Test #66:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

XUKSIYXNSSOECOXMRXU

output:

xuksiyxnBoecoxmrxu
xuksiyxnssoecoxmrxu

result:

ok correct

Test #67:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

VTRRKTFSWGBKHSRBSPVV

output:

vtrrktfswgbkhsrbspvv

result:

ok correct

Test #68:

score: 0
Accepted
time: 0ms
memory: 3708kb

input:

VHYYZSLSFAJXXRJSJRDF

output:

vhyyzslsfajxxrjsjrdf

result:

ok correct

Test #69:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

SSXLSMXANFXWGOTQVFVQ

output:

Bxlsmxanfxwgotqvfvq
ssxlsmxanfxwgotqvfvq

result:

ok correct