Editorial for 2188: Лінійні шахи
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
#include<bits/stdc++.h> #define mt make_tuple #define mp make_pair #define pu push_back #define INF 1000000001 #define MOD 1000000007 #define ll long long int #define ld long double #define vi vector<int> #define vll vector<long long int> #define fi first #define se second #define pr(v) { for(int i=0;i<v.size();i++) { v[i]==INF? cout<<"INF " : cout<<v[i]<<" "; } cout<<endl;} #define t1(x) cerr<<#x<<" : "<<x<<endl #define t2(x, y) cerr<<#x<<" : "<<x<<" "<<#y<<" : "<<y<<endl #define t3(x, y, z) cerr<<#x<<" : " <<x<<" "<<#y<<" : "<<y<<" "<<#z<<" : "<<z<<endl #define t4(a,b,c,d) cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<endl #define t5(a,b,c,d,e) cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<endl #define t6(a,b,c,d,e,f) cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<" "<<#f<<" : "<<f<<endl #define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME #define t(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__) #define _ cout<<"here"<<endl; #define __ {ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);} using namespace std; int main() { __; int t; cin>>t; while(t--) { vector<int> v; string s; cin>>s; int pos = -1; for(int i=0;i<s.size();i++) { // t(i,pos); if(s[i]=='.') continue; else {v.push_back(i-pos-1); pos = i;} } reverse(v.begin(),v.end()); // pr(v); ll count = 0; for(int i=0;i<v.size();i++) if(i%2==0) count^=(v[i]%3); if(count==0) cout<<"No"<<endl; else cout<<"Yes"<<endl; } return 0; }
Коментарі