Submission #547640

#TimeUsernameProblemLanguageResultExecution timeMemory
547640flashhhAncient Machine (JOI21_ancient_machine)C++17
0 / 100
68 ms10348 KiB
#include <bits/stdc++.h> #include "Anna.h" using namespace std; void send(char x) { if (x == 'X') { Send(0); Send(0); } else if (x == 'Y') { Send(0); Send(1); } else { Send(1); Send(0); } } void Anna(int n,vector<char> s) { for (int i=0;i<n;++i) send(s[i]); }
#include <bits/stdc++.h> #include "Bruno.h" #define N 100005 #define pii pair<int,int> #define fi first #define se second #define pb emplace_back #define getbit(x,y) (((x)>>(y))&1) #define getoff(x,y) ((x)^(1<<(y))) using namespace std; int n,l; char a[N]; bool erased[N]; vector<int> s; void Bruno(int n1,int l1,vector<int> s1) { n = n1; l = l1; s = s1; for (int i=0;i<n;++i) if (s[i<<1] == 0) { if (s[i<<1|1] == 0) a[i+1] = 'X'; else a[i+1] = 'Y'; } else a[i+1] = 'Z'; int x = 1; while (x <= n) { while (x <= n && a[x] != 'X') { Remove(x-1); ++x; } int z = x; while (z <= n && a[z] != 'Z') ++z; if (z == n + 1) { for (int i=x;i<z;++i) Remove(i-1); break; } int p = z - 1; while (p >= x) { int pos = -1; int q = p; while (p >= x && a[p] != 'X') --p; for (int i=p+1;i<=q;++i) if (a[i] == 'Y') { pos = i; break; } else Remove(i-1); if (pos != -1) { for (int i=pos+1;i<=q;++i) Remove(i-1); Remove(pos-1); } Remove(p-1); --p; } Remove(z-1); x = z + 1; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...