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

Code

#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <unordered_map>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define F first
#define S second
#define X first
#define Y second

const ll N = 1e2 + 5;
const ll INF = 1e18;
const ll M = 1e5 + 5;

unordered_map<ll, bool> ma;

ll ha(ll a, ll b) {
	if(a > b) swap(a, b);
	return N*a + b;
}




bool z[M];

int main() {
	int t;
	cin >> t;
	while(t > 0) {
		--t;
		string s;
		cin >> s;
		int n = s.size();
		int a = -1; int b = -1;
		for(int i = 0; i < n; ++i) {
			if(s[i] == 'P') {
				if(a == -1) {
					a = i;
				} else {
					b = i;
					break;
				}
			}
		}

		if((a+b)%2 == 1) {
			cout << 2 << "\n";
		} else {
			cout << 1 << "\n";
		}


	}
}

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