# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
441036 | 2021-07-04T00:50:55 Z | kig9981 | Ancient Machine (JOI21_ancient_machine) | C++17 | 0 ms | 0 KB |
#include "Anna.h" #include <bits/stdc++.h> #ifdef NON_SUBMIT #define TEST(n) (n) #define tout cerr #else #define TEST(n) ((void)0) #define tout cin #endif using namespace std; void Anna(int N, std::vector<char> S) { vector<int> R(N); bool chk=false; int s=N, e=0; for(int i=0;i<N;i++) { if(S[i]=='X') s=min(s,i); else if(S[i]=='Y') e=i; } if(s>=e) return; R[s]=R[e]=1; for(int i=s+1;i<e;i++) if(S[i]=='Y' && S[i+1]!='Y') { R[i]=1; R[i+1]=S[i+1]=='Z'; chk=true; } if(chk)for(auto r: R) Send(r); }