#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int) x.size())
#define show(x) cerr << #x << " is " << x << endl;
#define show2(x, y) cerr << #x << " is " << x << ", " << #y << " is " << y << endl;
typedef long long lint;
typedef pair<lint, lint> ii;
void Anna(int n, vector<char> s){
int X = -1;
for(int i = 0;i < n;i++){
if(s[i] == 'X'){
X = i;
break;
}
}
if(X == -1) return;
vector<int> tosend;
for(int i = X+1;i < n;i++){
if(s[i] == 'Z'){
if(tosend.empty() or tosend.back() == 0) tosend.push_back(1);
else tosend.push_back(0);
}
else tosend.push_back(0);
}
for(int x : tosend) Send(x);
for(int i = 0;i < 18;i++){
Send(X&1);
X >>= 1;
}
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int) x.size())
#define show(x) cerr << #x << " is " << x << endl;
#define show2(x, y) cerr << #x << " is " << x << ", " << #y << " is " << y << endl;
typedef long long lint;
typedef pair<lint, lint> ii;
void Bruno(int n, int L, vector<int> A){
int vis[n]; fill(vis,vis+n,0);
if(sz(A) == 0){
for(int i = 0;i < n;i++) Remove(i);
return;
}
int X = 0;
for(int i = 0;i < 18;i++){
X *= 2;
X += A.back();
A.pop_back();
}
int prev = X+1;
for(int i = X+1;i < n;i++){
int a = A[i-X-1];
if(a == 1){
for(int j = i-1;j >= prev;j--) Remove(j), vis[j] = 1;
Remove(i); vis[i] = 1;
prev = i+1;
}
}
for(int i = 0;i < n;i++){
if(not vis[i]) Remove(i);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
480 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
66 ms |
8568 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |