#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 && 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 |
Incorrect |
1 ms |
792 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
45 ms |
9628 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |