# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
715215 | duchuy297 | Ancient Machine (JOI21_ancient_machine) | C++17 | 90 ms | 9712 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int variable_example = 0;
}
void Anna(int N, std::vector<char> S) {
for (auto u : S) {
if (u == 'X') Send (0), Send (0);
else if (u == 'Y') Send (0), Send(1);
else Send (1), Send(0);
}
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
void Bruno(int N, int L, std::vector<int> A) {
string s;
int n = N;
for (int i=0; i<2*n; i+=2) {
if (A[i] == 0 && A[i+1] == 0) s.push_back('X');
else if (A[i] == 0 && A[i+1] == 1) s.push_back('Y');
else s.push_back('Z');
}
int l = -1, r = -1;
for (int i=0; i<n; i++) {
if (s[i] == 'X') {
l = i;
break;
}
}
for (int i=n-1; i>=0; i--) {
if (s[i] == 'Z') {
r = i;
break;
}
}
// cout << s << ' ' << l << ' ' << r << '\n';
if (l == -1 || r == -1) {
for (int i=0; i<n; i++) Remove(i);
return;
}
for (int i=0; i<l; i++) Remove(i);
for (int i=r+1; i<n; i++) Remove(i);
stack<int> st;
st.push(l);
for (int i=l+1; i<=r; i++) {
int u = st.top();
if (s[i] == s[u]) {
Remove(i);
continue;
}
if (s[i] == 'Z') {
while (st.size() > 1) {
int u = st.top();
Remove(u);
st.pop();
}
Remove(i);
}
else st.push(i);
}
while (st.size()) {
int u = st.top();
Remove(u);
st.pop();
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |