#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);
}
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |