# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1071042 | ttamx | Ancient Machine (JOI21_ancient_machine) | C++17 | 54 ms | 9048 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
void Anna(int n,vector<char> s){
int seq=0,cnt=0,pw=1;
for(int i=0;i<n;i++){
seq+=pw*(s[i]-'X');
cnt++;
pw*=3;
if(cnt==5){
for(int j=0;j<8;j++){
Send(seq>>j&1);
}
seq=cnt=0;
pw=1;
}
}
if(cnt>0){
for(int j=0;j<8;j++){
Send(seq>>j&1);
}
}
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
void Bruno(int n,int m,vector<int> a){
assert(m%8==0);
vector<char> s;
for(int i=0;i<m;i+=8){
int seq=0;
for(int j=0;j<8;j++){
seq|=(a[i+j]<<j);
}
for(int j=0;j<5;j++){
s.emplace_back(char('X'+(seq%3)));
seq/=3;
}
}
assert(s.size()>=n);
s.resize(n);
stack<int> st;
for(int i=0;i<n;i++){
if(s[i]=='X'){
if(st.empty()||s[st.top()]=='Y'){
st.emplace(i);
}else{
Remove(i);
}
}else if(s[i]=='Y'){
if(!st.empty()&&s[st.top()]=='X'){
st.emplace(i);
}else{
Remove(i);
}
}else if(s[i]=='Z'){
while(st.size()>1){
Remove(st.top());
st.pop();
}
Remove(i);
}else{
assert(false);
}
}
while(!st.empty()){
Remove(st.top());
st.pop();
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |