# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1071151 | thinknoexit | Ancient Machine (JOI21_ancient_machine) | C++17 | 39 ms | 8936 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Anna.h"
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
namespace {
int n;
}
void Anna(int N, vector<char> S) {
n = N;
for (int i = 0;i < n;i++) {
int v = S[i] - 'X';
Send(!!(v & 1));
Send(!!(v & 2));
}
}
#include "Bruno.h"
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
namespace {
int n;
int a[100100];
} // namespace
void Bruno(int N, int L, vector<int> A) {
n = N;
for (int i = 0;i < n;i++) {
a[i] = A[2 * i] + 2 * A[2 * i + 1];
}
stack<int> x, z;
for (int i = n - 1;i >= 0;i--) if (a[i] == 2) z.push(i);
for (int i = 0;i < n;i++) {
while (!z.empty() && z.top() <= i) z.pop();
if (a[i] == 0) x.push(i);
else if (a[i] == 1) {
if (x.empty() || z.empty()) {
Remove(i);
continue;
}
int l = x.top(), r = z.top();
x.pop(), z.pop();
for (int j = i + 1;j < r;j++) Remove(j);
Remove(i);
Remove(l), Remove(r);
i = r;
}
}
while (!x.empty()) {
Remove(x.top());
x.pop();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |