QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#325040 | #5596. I Could Have Won | thanhha1210 | WA | 0ms | 3760kb | C++17 | 852b | 2024-02-11 03:36:14 | 2024-02-11 03:36:14 |
Judging History
answer
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
int check(const string& s, int& k) {
int cnt1 = 0, cnt2 = 0, k1 = 0, k2 = 0; // 1 is Alice, 2 is Bob
int i = 0;
while (i < s.length()) {
if (s[i] == 'A')
k1++;
else
k2++;
if (k1 == k) {
cnt1++;
k1 = k2 = 0;
}
else if (k2 == k) {
cnt2++;
k1 = k2 = 0;
}
i++;
}
if (cnt1 > cnt2)
return true;
return false;
}
int main() {
string s;
cin >> s;
vector<int> res;
for (int i = 1; i < s.length(); i++)
if (check(s, i))
res.emplace_back(i);
cout << res.size() << endl;
for (int i = 0; i < res.size(); i++)
cout << res[i] << " ";
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3576kb
input:
BBAAABABBAAABB
output:
3 3 6 7
result:
ok 2 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 3492kb
input:
AABBBAAB
output:
2 2 4
result:
ok 2 lines
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3760kb
input:
A
output:
0
result:
wrong answer 1st lines differ - expected: '1', found: '0'