Submission #935477

# Submission time Handle Problem Language Result Execution time Memory
935477 2024-02-29T07:48:23 Z SmuggingSpun Ancient Machine (JOI21_ancient_machine) C++17
0 / 100
54 ms 9972 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--);
	}
	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);
				}
				while(ptr > -1 && a[ptr] == X){
					Remove(ptr--);
				}
			}
		}
		Remove(last);
	}
}

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 780 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 54 ms 9964 KB Partially correct
2 Incorrect 47 ms 9972 KB Wrong Answer [5]
3 Halted 0 ms 0 KB -