QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#636822 | #9454. String of CCPC | ucup-team3695# | WA | 8ms | 4024kb | C++20 | 592b | 2024-10-13 03:10:30 | 2024-10-13 03:10:31 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main()
{
cin.tie(0)->sync_with_stdio(0);
int tc;
cin >> tc;
while (tc--)
{
int n;
string s, t;
cin >> n >> s;
s = '$' + s + "$$";
bool ans = false;
for (int i = 0; i + 3 <= n; i++)
{
char a = s[i], b = s[i + 1], c = s[i + 2], d = s[i + 3], e = s[i + 4], f = s[i + 5];
ans |= a != 'C' && b == 'C' && c == 'P' && d == 'C';
ans |= b == 'C' && c == 'C' && d == 'P' && e != 'C';
ans |= b == 'C' && c == 'C' && d == 'C' && (e != 'P' || f != 'P');
}
cout << int(ans) << '\n';
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3632kb
input:
3 3 CCC 5 CCCCP 4 CPCP
output:
1 1 1
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 8ms
memory: 4024kb
input:
20003 5 PCCPC 10 CPPPPCPCPC 4 CPPC 11 CCPPCPPPCCP 17 PPPPCPCCCCCPCCCCC 10 PPCCPCPPCP 9 CPCCCCPPC 11 PCPPPPCCPPP 15 CPCPPPPCCPCPCCC 11 PCCPPCCPCPP 9 PCPCCPPCP 10 CCPCPPPCPP 14 CCCCPPPCPCPCPP 2 CC 12 CCPCPPPPPCPP 6 CPPPPP 12 PCCPCCCCCPCC 16 CPCCPCCPPCCCCPPC 7 CPPPCPC 16 PPPPPCCPCPCPCPPC 13 PPPCPCCCCPP...
output:
0 1 0 1 1 0 1 1 1 1 1 0 1 0 0 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 0 0 1 1 1 0 1 1 0 1 1 0 1 0 1 0 1 1 1 0 1 1 1 1 1 0 0 1 0 0 1 1 1 1 1 1 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 0 1 0 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 0 1 0 1 1 1 0 0 1 0 1 0 1 1 1 1 1 1 1 0 0 0 1 1 0 1 1 ...
result:
wrong answer 1st lines differ - expected: '1', found: '0'