# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
574969 | Arvin | Ancient Machine (JOI21_ancient_machine) | C++17 | 70 ms | 8844 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
namespace {
int variable_example = 0;
const int maxN = 1e5 + 5;
}
struct SegmentTree {
int tree[2*maxN];
int n;
void reset(){
fill(tree, tree+2*maxN, 1e9);
}
void build(int n, vector<int> &v){
this->n = n;
for(int x=0;x<n;x++){
tree[n+x] = v[x];
}
for(int x=n-1;x>0;x--){
tree[x] = min(tree[x<<1], tree[x<<1|1]);
}
}
void update(int pos, int val){
pos += n;
tree[pos] = val;
for(int x=pos;x>1;x>>=1){
tree[x>>1] = min(tree[x], tree[x^1]);
}
}
int query(int left, int right){ // [L, R)
int ans = 1e9;
for(left += n, right += n; left < right; left >>= 1, right >>= 1){
if(left&1){
ans = min(ans, tree[left++]);
}
if(right&1){
ans = min(ans, tree[--right]);
}
}
return ans;
}
} tree;
void Anna(int N, std::vector<char> S) {
// 1 as store this first X or any Z after first Xa
// 0 otherwise
vector<int> v;
int pos = -2;
bool fX = false;
for(int x=0;x<N;x++){
if(S[x] == 'Z'){
if(fX && (x+1 == N || S[x+1] != 'Z')){
v.push_back(1);
} else {
v.push_back(0);
}
// Send(fX);
} else if(S[x] == 'Y'){ // XYXYZYZYZYZ (occurences of X are always first than Y)
// Send(0);
v.push_back(0);
} else if(S[x] == 'X'){
if(!fX){
v.push_back(1);
// Send(1);
fX = true;
pos = x;
} else {
v.push_back(0);
// Send(0);
}
}
}
for(auto val : v){
Send(val);
}
// Send(v[0]);
// bool skip = false;
// for(int x=0;x<N;x++){
// if(skip){
// skip = false;
// continue;
// }
// if(v[x] == 0){
// if(x+1 == N || v[x+1] == 1){
// Send(0);
// if(x+1 < N && v[x+1] == 1) Send(1);
// else Send(0);
// } else {
// Send(1);
// if(x+2 < N && v[x+2] == 1){
// Send(1);
// } else {
// Send(0);
// }
// skip = true;
// }
// }
// }
}
#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]);
// }
assert(L <= N);
vector<int> ans;
int pos = -1, lst = 0;
for(int x=0;x<L;x++){
if(A[x] == 1){
if(pos == -1){
pos = x;
lst = x+1;
} else {
for(int y=x-1;y>=lst;y--){
ans.push_back(y);
}
ans.push_back(x);
lst = x+1;
}
}
}
for(int x=0;x<=pos;x++){
ans.push_back(x);
}
for(int x=lst;x<N;x++){
ans.push_back(x);
}
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... |