Submission #1071207

# Submission time Handle Problem Language Result Execution time Memory
1071207 2024-08-23T05:55:13 Z 김은성(#11136) Ancient Machine (JOI21_ancient_machine) C++17
0 / 100
25 ms 4640 KB
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
void Anna(int N, std::vector<char> S) {
	int i;
	for(i=0; i<N; i++){
		int bit = S[i] - 'X' + 1;
		Send(bit/2);
		Send(bit%2);
	}
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
int s[200009];
void Bruno(int N, int L, std::vector<int> A) {
	int i;
	for(i=0; i<N; i++){
		s[i] = 2 * A[2*i] + A[2*i+1] - 1;
	}
	vector<int> st;
	int one = 0;
	for(i=0; i<N; i++){
		if(s[i] == 0)
			st.push_back(i);
		else if(s[i] == 1){
			if(st.empty()){
				Remove(i);
				continue;
			}
			one++;
			st.push_back(i);
		}
		else{
			if(!one){
				Remove(i);
				continue;
			}
			vector<int> tbd;
			int crit = -1;
			while(1){
				if(crit != -1 && st.back() == 0)
					break;
				if(st.back() == 1 && crit == -1)
					crit = st.back();
				else
					tbd.push_back(st.back());
				if(st.back() == 1)
					one--;
				st.pop_back();
			}
			for(int u: tbd)
				Remove(u);
			Remove(crit);
			//printf("crit=%d\n", crit);
			Remove(i);
		}
	}
	for(int u: st)
		Remove(u);
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 792 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 4640 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -