답안 #1071214

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1071214 2024-08-23T05:59:31 Z 김은성(#11136) Ancient Machine (JOI21_ancient_machine) C++17
0 / 100
48 ms 9712 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){
				//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);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 788 KB Output is correct
2 Correct 0 ms 796 KB Output is correct
3 Correct 0 ms 792 KB Output is correct
4 Correct 0 ms 780 KB Output is correct
5 Incorrect 0 ms 796 KB Wrong Answer [6]
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 48 ms 9712 KB Partially correct
2 Incorrect 48 ms 9524 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -