답안 #417308

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
417308 2021-06-03T14:39:32 Z errorgorn Ancient Machine (JOI21_ancient_machine) C++17
30 / 100
98 ms 10832 KB
#include "Anna.h"

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ii pair<ll,ll>
#define fi first
#define se second
#define endl '\n'

#define puf push_front
#define pof pop_front
#define pub push_back
#define pob pop_back
#define lb lower_bound
#define ub upper_bound

#define rep(x,s,e) for (auto x=s-(s>e);x!=e-(s>e);(s<e?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()

namespace {
	int n;
	vector<char> s;
}

void Anna(int N, std::vector<char> S) {
	n=N;
	s=S;
	
	rep(x,0,n){
		if (s[x]=='X') Send(0),Send(0);
		if (s[x]=='Y') Send(0),Send(1);
		if (s[x]=='Z') Send(1),Send(0);
	}
}
#include "Bruno.h"

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ii pair<ll,ll>
#define fi first
#define se second
#define endl '\n'

#define puf push_front
#define pof pop_front
#define pub push_back
#define pob pop_back
#define lb lower_bound
#define ub upper_bound

#define rep(x,s,e) for (auto x=s-(s>e);x!=e-(s>e);(s<e?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()

namespace {
	int n,l;
	vector<int> bits;
	string s;

}  // namespace

void Bruno(int N, int L, std::vector<int> A) {
	n=N,l=L,bits=A;
	
	rep(x,0,n){
		if (bits[2*x]==0 && bits[2*x+1]==0) s+='X';
		if (bits[2*x]==0 && bits[2*x+1]==1) s+='Y';
		if (bits[2*x]==1 && bits[2*x+1]==0) s+='Z';
	}
	
	vector<int> stk;
	
	rep(x,0,n){
		if (s[x]=='X'){
			if (sz(stk)%2==0) stk.pub(x);
			else Remove(x);
		}
		else if (s[x]=='Y'){
			if (sz(stk)%2==1) stk.pub(x);
			else Remove(x);
		}
		else{
			while (sz(stk)>1){
				Remove(stk.back());
				stk.pob();
			}
			Remove(x);
		}
	}
	
	while (!stk.empty()){
		Remove(stk.back());
		stk.pob();
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 492 KB Output is correct
2 Correct 0 ms 484 KB Output is correct
3 Correct 0 ms 484 KB Output is correct
4 Correct 0 ms 484 KB Output is correct
5 Correct 0 ms 484 KB Output is correct
6 Correct 0 ms 492 KB Output is correct
7 Correct 0 ms 484 KB Output is correct
8 Correct 0 ms 484 KB Output is correct
9 Correct 0 ms 484 KB Output is correct
10 Correct 0 ms 484 KB Output is correct
11 Correct 0 ms 484 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 87 ms 9972 KB Partially correct
2 Partially correct 90 ms 10444 KB Partially correct
3 Partially correct 88 ms 10392 KB Partially correct
4 Partially correct 86 ms 10312 KB Partially correct
5 Partially correct 86 ms 10404 KB Partially correct
6 Partially correct 86 ms 10376 KB Partially correct
7 Partially correct 89 ms 10356 KB Partially correct
8 Partially correct 88 ms 10324 KB Partially correct
9 Partially correct 94 ms 10392 KB Partially correct
10 Partially correct 87 ms 10324 KB Partially correct
11 Partially correct 88 ms 10472 KB Partially correct
12 Partially correct 86 ms 10412 KB Partially correct
13 Partially correct 93 ms 10832 KB Partially correct
14 Partially correct 94 ms 10320 KB Partially correct
15 Partially correct 93 ms 10532 KB Partially correct
16 Partially correct 85 ms 10328 KB Partially correct
17 Partially correct 91 ms 10344 KB Partially correct
18 Partially correct 94 ms 10320 KB Partially correct
19 Partially correct 98 ms 10420 KB Partially correct
20 Partially correct 85 ms 10316 KB Partially correct
21 Partially correct 84 ms 10324 KB Partially correct
22 Partially correct 94 ms 10436 KB Partially correct
23 Partially correct 85 ms 10372 KB Partially correct
24 Partially correct 85 ms 10332 KB Partially correct
25 Partially correct 95 ms 10356 KB Partially correct
26 Partially correct 95 ms 10304 KB Partially correct
27 Partially correct 95 ms 10492 KB Partially correct
28 Partially correct 98 ms 10332 KB Partially correct
29 Partially correct 96 ms 10400 KB Partially correct
30 Partially correct 96 ms 10536 KB Partially correct
31 Partially correct 96 ms 10412 KB Partially correct
32 Partially correct 87 ms 10328 KB Partially correct
33 Partially correct 86 ms 10304 KB Partially correct