# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
547648 | flashhh | Ancient Machine (JOI21_ancient_machine) | C++17 | 81 ms | 10464 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
for (int i=1;i<=n;++i)
if (a[i] == 'X') {
x = i;
break;
}
if (x == -1) {
for (int i=0;i<n;++i) Remove(i);
return;
}
int z = x + 1;
while (z <= n) {
int t = z;
while (t <= n && a[t] != 'Z') ++t;
if (t == n + 1) {
for (int i=z;i<t;++i) Remove(i-1);
break;
}
int p = t - 1;
while (p >= z) {
int pos = -1; int q = p;
while (p >= z && 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);
}
if (p != x && p >= z) Remove(p-1);
--p;
}
Remove(t-1);
z = t + 1;
}
for (int i=1;i<=x;++i) Remove(i-1);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |