CSES - Putka Open 2020 – 4/5 - Results
Submission details
Task:Peli
Sender:hltk
Submission time:2020-11-06 19:05:39 +0200
Language:C++17
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED35
#2ACCEPTED65
Test results
testverdicttimegroup
#1ACCEPTED0.01 s1, 2details
#2ACCEPTED0.01 s2details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:14:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&tc);
  ~~~~~^~~~~~~~~~
input/code.cpp:16:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s",s);
   ~~~~~^~~~~~~~

Code

#include<bits/stdc++.h>
#define sz(x) ((int)(x).size())
#define all(x) x.begin(),x.end()
using namespace std;
using pi = pair<int,int>;
using lint = long long;
const int MAXN = 105;

int n;
char s[MAXN];

int main(){
	int tc;
	scanf("%d",&tc);
	while(tc--){
		scanf("%s",s);
		n = strlen(s);
		int a = -1, b = -1;
		for(int i=0; i<n; ++i){
			if(s[i] == 'P'){
				if(a == -1) a = i;
				else b = i;
			}
		}
		printf("%d\n", 2 - ((b - a - 1) & 1));
	}
}

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
...

Test 2

Group: 2

Verdict: ACCEPTED

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

correct output
2
1
2
1
1
...

user output
2
1
2
1
1
...