# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
574504 | Arvin | Ancient Machine (JOI21_ancient_machine) | C++17 | 38 ms | 5216 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
namespace {
int variable_example = 0;
}
void Anna(int N, std::vector<char> S) {
vector<int> ans;
vector<pair<int, int>> v;
int pos = -1;
for(int x=0;x<N;x++){
if(S[x] == 'Z'){
while(!v.empty()){
if(pos != -1){
Send(1);
ans.push_back(pos);
}
Send(1);
ans.push_back(v.back().second);
pos = v.back().first;
v.pop_back();
}
Send(1);
ans.push_back(x);
} else if(S[x] == 'Y'){
if(pos != -1){
Send(0);
v.push_back({pos, x});
pos = -1;
} else {
Send(1);
ans.push_back(x);
}
} else if(S[x] == 'X'){
if(pos != -1){
Send(1);
ans.push_back(x);
} else {
Send(0);
pos = x;
}
}
}
while(!v.empty()){
Send(1); Send(1);
ans.push_back(v.back().first);
ans.push_back(v.back().second);
v.pop_back();
}
if(pos != -1){
Send(1);
ans.push_back(pos);
pos = -1;
}
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
namespace {
int variable_example = 0;
int FunctionExample(int P) { return 1 - P; }
} // namespace
void Bruno(int N, int L, std::vector<int> A) {
// for (int i = 0; i < L; i++) {
// variable_example += FunctionExample(A[i]);
// }
vector<int> ans;
vector<int> v;
int lst = 0;
for(int x=0;x<N;x++){
if(A[x] == 0){
v.push_back(x);
lst = x+1;
} else if(A[x] == 1){
if(x+1 < N && A[x+1] == 1) continue;
int cnt = x-lst+1;
cnt--;
while(cnt > 0){
ans.push_back(v.back());
v.pop_back();
}
ans.push_back(x);
lst = x+1;
}
}
for(auto val : ans){
// cout << "- " << val << "\n";
Remove(val);
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |