Submission #537700

#TimeUsernameProblemLanguageResultExecution timeMemory
537700Jarif_RahmanAncient Machine (JOI21_ancient_machine)C++17
30 / 100
91 ms9696 KiB
#include "Anna.h" #include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef string str; namespace { } void Anna(int n, vector<char> s){ for(int i = 0; i < n; i++){ if(s[i] == 'X') Send(0), Send(0); else if(s[i] == 'Y') Send(0), Send(1); else Send(1); } }
#include "Bruno.h" #include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef string str; namespace { } void Bruno(int n, int m, vector<int> A){ str s = ""; for(int i = 0; i < m; i++){ if(A[i] == 0){ if(A[i+1] == 0) s+="X"; else s+="Y"; i++; } else s+="Z"; } list<pair<int, char>> ls; for(int i = 0; i < n; i++) ls.pb({i, s[i]}); for(auto it = ls.begin(); it != ls.end();){ if(it == ls.begin() || prev(it)->sc != it->sc){ it++; continue; } Remove(it->f); it = ls.erase(it); } while(!ls.empty() && ls.begin()->sc != 'X') Remove(ls.begin()->f), ls.erase(ls.begin()); while(!ls.empty() && prev(ls.end())->sc != 'Z') Remove(prev(ls.end())->f), ls.erase(prev(ls.end())); if(ls.empty()) return; for(auto it = ls.begin(); it != ls.end();){ if(it->sc != 'Z'){ it++; continue; } for(auto it2 = prev(it); it2 != ls.begin();) Remove(it2->f), it2 = ls.erase(it2), it2--; Remove(it->f); it = ls.erase(it); } Remove(ls.begin()->f); ls.erase(ls.begin()); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...