#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int n;
}
void Anna(int N, vector<char> S) {
n = N;
char need = 'X';
for(int i=0; i<n; i++){
int tmp = S[i] - 'X';
Send(tmp/2);
Send(tmp%2);
}
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int n;
int arr[100002];
set<int> st;
vector<int> X, Z;
} // namespace
void Bruno(int N, int L, vector<int> A) {
n = N;
for(int i=0; i<n; i++){
arr[i] = A[i*2] * 2 + A[i*2+1];
st.insert(i);
}
for(int i=0; i<n; i++){
if(arr[i] == 2) Z.push_back(i);
}
reverse(Z.begin(), Z.end());
for(int i=0; i<n; i++){
if(st.find(i) == st.end()) continue;
if(arr[i] == 0) X.push_back(i);
else if(arr[i] == 1){
if(X.empty()) continue;
while(!Z.empty() && (Z.back() < i || st.find(Z.back()) == st.end())) Z.pop_back();
if(Z.empty()) break;
int x = X.back();
int z = Z.back();
X.pop_back();
Z.pop_back();
auto it = st.upper_bound(x);
while(it != st.end() && *it < z){
auto it2 = it;
++it2;
if(*it == i){
it = it2;
continue;
}
Remove(*it);
st.erase(it);
it = it2;
}
Remove(i);
st.erase(i);
}
}
for(auto x: st) Remove(x);
}
Compilation message
Anna.cpp: In function 'void Anna(int, std::vector<char>)':
Anna.cpp:12:10: warning: unused variable 'need' [-Wunused-variable]
12 | char need = 'X';
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
488 KB |
Output is correct |
2 |
Correct |
2 ms |
488 KB |
Output is correct |
3 |
Correct |
2 ms |
488 KB |
Output is correct |
4 |
Correct |
1 ms |
488 KB |
Output is correct |
5 |
Incorrect |
2 ms |
572 KB |
Wrong Answer [6] |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
121 ms |
10200 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |