CSES - Putka Open 2020 – 4/5 - Results
Submission details
Task:Peli
Sender:Grez
Submission time:2020-11-07 09:30:35 +0200
Language:C++ (C++17)
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED35
#2ACCEPTED65
Test results
testverdicttimegroup
#1ACCEPTED0.01 s1, 2details
#2ACCEPTED0.01 s2details

Code

#include <iostream>
using namespace std;

int main()
{
    int amo;
    cin >> amo;

    for (int i = 0; i < amo; i++) {
        string peli;
        cin >> peli;
        int c = 0;
        bool started = false;
        for (int i = peli.size() - 1; i >= 0; i--) {
            if (peli[i] == 'P') {
                if (started) {
                    cout << (2 - (c & 1)) << endl;
                    break;
                }
                else {
                    c = 1;
                    started = true;
                }
            }
            c++;
        }
    }
}

Test details

Test 1

Group: 1, 2

Verdict: ACCEPTED

input
100
PP.
P......P.
.PP
..P.P.
...

correct output
2
2
2
1
2
...

user output
2
2
2
1
2
...
Truncated

Test 2

Group: 2

Verdict: ACCEPTED

input
100
.................................

correct output
2
1
2
1
1
...

user output
2
1
2
1
1
...
Truncated