Submission #394904

# Submission time Handle Problem Language Result Execution time Memory
394904 2021-04-27T13:05:16 Z oolimry Ancient Machine (JOI21_ancient_machine) C++17
69 / 100
90 ms 8592 KB
#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') tosend.push_back(1);
		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 Correct 2 ms 492 KB Output is correct
2 Correct 2 ms 484 KB Output is correct
3 Correct 2 ms 484 KB Output is correct
4 Correct 2 ms 484 KB Output is correct
5 Correct 2 ms 484 KB Output is correct
6 Correct 2 ms 496 KB Output is correct
7 Correct 2 ms 484 KB Output is correct
8 Correct 2 ms 484 KB Output is correct
9 Correct 2 ms 488 KB Output is correct
10 Correct 2 ms 484 KB Output is correct
11 Correct 2 ms 484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 64 ms 8468 KB Partially correct
2 Partially correct 74 ms 8536 KB Partially correct
3 Partially correct 67 ms 8516 KB Partially correct
4 Partially correct 83 ms 8516 KB Partially correct
5 Partially correct 65 ms 8556 KB Partially correct
6 Partially correct 73 ms 8488 KB Partially correct
7 Partially correct 63 ms 8592 KB Partially correct
8 Partially correct 63 ms 8548 KB Partially correct
9 Partially correct 88 ms 8504 KB Partially correct
10 Partially correct 66 ms 8516 KB Partially correct
11 Partially correct 63 ms 8448 KB Partially correct
12 Partially correct 64 ms 8592 KB Partially correct
13 Partially correct 73 ms 8540 KB Partially correct
14 Partially correct 90 ms 8588 KB Partially correct
15 Partially correct 68 ms 8540 KB Partially correct
16 Partially correct 68 ms 8564 KB Partially correct
17 Partially correct 74 ms 8532 KB Partially correct
18 Correct 61 ms 6844 KB Output is correct
19 Correct 61 ms 6788 KB Output is correct
20 Partially correct 63 ms 8532 KB Partially correct
21 Partially correct 71 ms 8468 KB Partially correct
22 Partially correct 76 ms 8544 KB Partially correct
23 Partially correct 64 ms 8528 KB Partially correct
24 Partially correct 71 ms 8556 KB Partially correct
25 Correct 66 ms 6692 KB Output is correct
26 Partially correct 72 ms 8544 KB Partially correct
27 Correct 52 ms 6636 KB Output is correct
28 Partially correct 79 ms 8568 KB Partially correct
29 Correct 55 ms 6800 KB Output is correct
30 Correct 53 ms 6732 KB Output is correct
31 Correct 63 ms 6624 KB Output is correct
32 Partially correct 63 ms 8520 KB Partially correct
33 Partially correct 74 ms 8496 KB Partially correct