Submission #417438

#TimeUsernameProblemLanguageResultExecution timeMemory
417438errorgornAncient Machine (JOI21_ancient_machine)C++17
69 / 100
81 ms8856 KiB
#include "Anna.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define ii pair<ll,ll> #define fi first #define se second #define endl '\n' #define puf push_front #define pof pop_front #define pub push_back #define pob pop_back #define lb lower_bound #define ub upper_bound #define rep(x,s,e) for (auto x=s-(s>e);x!=e-(s>e);(s<e?x++:x--)) #define all(x) (x).begin(),(x).end() #define sz(x) (int) (x).size() namespace { int n; string s; } void Anna(int N, std::vector<char> S) { n=N; rep(x,0,n) s+=S[x]; int pos=0; rep(x,0,n) if (s[x]=='X'){ pos=x; break; } rep(x,0,17){ if (pos&1) Send(1); else Send(0); pos>>=1; } rep(x,0,n){ if (s[x]=='Z') Send(1); else Send(0); } }
#include "Bruno.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define ii pair<ll,ll> #define fi first #define se second #define endl '\n' #define puf push_front #define pof pop_front #define pub push_back #define pob pop_back #define lb lower_bound #define ub upper_bound #define rep(x,s,e) for (auto x=s-(s>e);x!=e-(s>e);(s<e?x++:x--)) #define all(x) (x).begin(),(x).end() #define sz(x) (int) (x).size() namespace { int n,l; vector<int> bits; string s; set<int> z; } // namespace void Bruno(int N, int L, std::vector<int> A) { n=N,l=L,bits=A; int pos=0; rep(x,0,17) pos+=bits[x]*(1<<x); vector<int> stk; rep(x,0,pos+1) stk.pub(x); rep(x,pos+1,n){ if (bits[x+17]){ while (stk.back()!=pos){ Remove(stk.back()); stk.pob(); } Remove(x); } else{ stk.pub(x); } } rep(x,0,sz(stk)) Remove(stk[x]); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...