Submission #935479

# Submission time Handle Problem Language Result Execution time Memory
935479 2024-02-29T07:50:57 Z SmuggingSpun Ancient Machine (JOI21_ancient_machine) C++17
0 / 100
30 ms 4620 KB
#include "Anna.h"
#include<bits/stdc++.h>
using namespace std;
void Anna(int n, vector<char>S){
	for(char& c : S){
		if(c == 'X'){
			Send(0);
			Send(0);
		}
		else if(c == 'Y'){
			Send(1);
			Send(0);
		}
		else{
			Send(0);
			Send(1);
		}
	}
}
#include "Bruno.h"
#include<bits/stdc++.h>
using namespace std;
void Bruno(int n, int sz_a, vector<int>A){
	const int X = 0, Y = 1, Z = 2;
	vector<int>a(n);
	for(int i = 0; i < sz_a; i += 2){
		a[i >> 1] = A[i] + (A[i + 1] << 1);
	}
	int ptr = n - 1;
	while(ptr > -1 && a[ptr] != Z){
		Remove(ptr-- + 1);
	}
	if(ptr > -1){
		int last = ptr--;
		while(ptr > -1){
			int r_ptr = ptr;
			while(ptr > -1 && a[ptr] != X){
				ptr--;
			}
			if(ptr > -1){
				for(int i = ptr + 1; i <= r_ptr; i++){
					Remove(i + 1);
				}
				while(ptr > -1 && a[ptr] == X){
					Remove(ptr-- + 1);
				}
			}
		}
		Remove(last + 1);
	}
}

Compilation message

Bruno.cpp: In function 'void Bruno(int, int, std::vector<int>)':
Bruno.cpp:5:19: warning: unused variable 'Y' [-Wunused-variable]
    5 |  const int X = 0, Y = 1, Z = 2;
      |                   ^
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 788 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 4620 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -