QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#155362 | #5680. You You See What? | rgnerdplayer# | AC ✓ | 1ms | 3796kb | C++20 | 1.5kb | 2023-09-01 16:09:04 | 2023-09-01 16:09:04 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
auto solve = [&]() {
string s;
cin >> s;
vector<string> a;
for (int i = 0, j = 0; i <= int(s.size()); i++) {
if (i == int(s.size()) || s[i] == '!') {
a.push_back(s.substr(j, i - j));
j = i + 1;
}
}
auto same = [&](string s, string t) {
if (s.size() != t.size()) {
return false;
}
for (int i = 0; i < int(s.size()); i++) {
if (tolower(s[i]) != tolower(t[i])) {
return false;
}
}
return true;
};
while (true) {
bool found = false;
for (int i = 0; i < int(a.size()) - 1; i++) {
for (auto d : {1, 2}) {
if (i + d < int(a.size()) - 1 && same(a[i], a[i + d])) {
a.erase(a.begin() + i + 1, a.begin() + i + d + 1);
found = true;
break;
}
}
}
if (!found) {
break;
}
}
for (int i = 0; i < int(a.size()); i++) {
cout << a[i] << "!\n"[i + 1 == int(a.size())];
}
};
solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3468kb
input:
texasam!rice!baylor!csdept!baylor!rice!dev!bresearch!bpoucher
output:
texasam!rice!dev!bresearch!bpoucher
result:
ok single line: 'texasam!rice!dev!bresearch!bpoucher'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3576kb
input:
texasam!Rice!baYlor!csdept!BayloR!dev!Rice!bresearch!bpoucher
output:
texasam!Rice!baYlor!dev!Rice!bresearch!bpoucher
result:
ok single line: 'texasam!Rice!baYlor!dev!Rice!bresearch!bpoucher'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3728kb
input:
bresearch!bpoucher
output:
bresearch!bpoucher
result:
ok single line: 'bresearch!bpoucher'
Test #4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!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!xx
result:
ok single line: 'a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!...!j!k!l!m!n!o!p!q!r!s!t!u!v!w!xx'
Test #6:
score: 0
Accepted
time: 1ms
memory: 3468kb
input:
a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z
output:
a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z
result:
ok single line: 'a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!...k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3500kb
input:
abcdEFGHij!bbcdEFGHij!cbcdEFGHij!dbcdEFGHij!ebcdEFGHij!fbcdEFGHij!gbcdEFGHij!hbcdEFGHij!ibcdEFGHij!jbcdEFGHij!kbcdEFGHij!lbcdEFGHij!mbcdEFGHij!nbcdEFGHij!obcdEFGHij!pbcdEFGHij!qbcdEFGHij!rbcdEFGHij!sbcdEFGHij!tbcdEFGHij!ubcdEFGHij!vbcdEFGHij!wbcdEFGHij!abc
output:
abcdEFGHij!bbcdEFGHij!cbcdEFGHij!dbcdEFGHij!ebcdEFGHij!fbcdEFGHij!gbcdEFGHij!hbcdEFGHij!ibcdEFGHij!jbcdEFGHij!kbcdEFGHij!lbcdEFGHij!mbcdEFGHij!nbcdEFGHij!obcdEFGHij!pbcdEFGHij!qbcdEFGHij!rbcdEFGHij!sbcdEFGHij!tbcdEFGHij!ubcdEFGHij!vbcdEFGHij!wbcdEFGHij!abc
result:
ok single line: 'abcdEFGHij!bbcdEFGHij!cbcdEFGH...FGHij!vbcdEFGHij!wbcdEFGHij!abc'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abc
output:
abcdEFGHij!abc
result:
ok single line: 'abcdEFGHij!abc'
Test #9:
score: 0
Accepted
time: 1ms
memory: 3512kb
input:
a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!bb
output:
a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!bb
result:
ok single line: 'a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!...!c!a!b!c!a!b!c!a!b!c!a!b!c!a!bb'
Test #10:
score: 0
Accepted
time: 1ms
memory: 3516kb
input:
aa!bB!aA!BB!Aa!Bb!Aa!BB!aA!bB!aa!bB!aA!BB!Aa!Bb!Aa!BB!aA!bB!aa!bB!aA!BB!Aa!Bb!Aa!BB!aA!bB!aa!bB!aA!BB!Aa!Bb!Aa!BB!aA!bB!aa!bB!aA!BB!Aa!Bb!Aa!BB!aA!bB!aa!bB!aA!BB!Aa!Bb!Aa!BB!aA!bB!aa!bB!aA!BB!Aa!Bb!Aa!BB!aA!bB!aa!bB!aA!BB!Aa!Bb!Aa!BB!aA!bB!aa!bB!aA!BB!Aa!B
output:
aa!B
result:
ok single line: 'aa!B'
Test #11:
score: 0
Accepted
time: 1ms
memory: 3796kb
input:
b
output:
b
result:
ok single line: 'b'
Test #12:
score: 0
Accepted
time: 1ms
memory: 3612kb
input:
bpoucher
output:
bpoucher
result:
ok single line: 'bpoucher'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3604kb
input:
Abcdefghij
output:
Abcdefghij
result:
ok single line: 'Abcdefghij'
Test #14:
score: 0
Accepted
time: 1ms
memory: 3576kb
input:
polyof!johnb
output:
polyof!johnb
result:
ok single line: 'polyof!johnb'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
polyvm!polyof!gracie!johnb
output:
polyvm!polyof!gracie!johnb
result:
ok single line: 'polyvm!polyof!gracie!johnb'
Test #16:
score: 0
Accepted
time: 1ms
memory: 3520kb
input:
a!b!b!c!c!d!d!d!e!e!e
output:
a!b!c!d!e!e
result:
ok single line: 'a!b!c!d!e!e'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
aaaa!bbbbb!bbbbb!testacct
output:
aaaa!bbbbb!testacct
result:
ok single line: 'aaaa!bbbbb!testacct'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3512kb
input:
a!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b
output:
a!b!b
result:
ok single line: 'a!b!b'
Test #19:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
a!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!bb!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b
output:
a!b!b
result:
ok single line: 'a!b!b'
Test #20:
score: 0
Accepted
time: 1ms
memory: 3476kb
input:
a!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!c!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b
output:
a!b!b
result:
ok single line: 'a!b!b'
Test #21:
score: 0
Accepted
time: 1ms
memory: 3584kb
input:
a!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!c!d!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b
output:
a!b!c!d!b!b
result:
ok single line: 'a!b!c!d!b!b'