Submission #1071227

# Submission time Handle Problem Language Result Execution time Memory
1071227 2024-08-23T06:03:50 Z 김은성(#11136) Ancient Machine (JOI21_ancient_machine) C++17
0 / 100
59 ms 9672 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){
				assert(!st.empty());
				//printf("i=%d crit=%d stb=%d\n", i, crit, st.back());
				if(crit != -1 && s[st.back()]== 0)
					break;
				if(s[st.back()] == 1 && crit == -1)
					crit = st.back();
				else
					tbd.push_back(st.back());
				if(s[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 Correct 0 ms 780 KB Output is correct
2 Correct 1 ms 792 KB Output is correct
3 Correct 0 ms 792 KB Output is correct
4 Correct 0 ms 792 KB Output is correct
5 Incorrect 0 ms 792 KB Wrong Answer [6]
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 49 ms 9628 KB Partially correct
2 Incorrect 59 ms 9672 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -