# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1078624 | 8pete8 | Ancient Machine (JOI21_ancient_machine) | C++17 | 49 ms | 8784 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Anna.h"
#include <vector>
using namespace std;
namespace {
int variable_example = 0;
}
void Anna(int N, vector<char> S){
int found=0;
for(auto i:S){
if(found==0){
if(i=='X')found=1;
Send(found);
}
else{
if(i=='Z')Send(1);
else Send(0);
}
}
}
/*
10
X Y X Y Z X Y Z Y Z
trying to solve in N
if we highlight all y and do it backward it might remove a z
but not an x between -xz
and wont remove x'z'yz
x yyyyyy xz yyyy z
we have to choose one
so the 2nd x will becomne uselss and the 2nd group of y
what if we remove all useless one first
then we will be left with
xyyyz xyyz xyyz
now can we just do from left to right
highlight first x and a pair of y->z
then we can get rid of useless one then remove left to right and save the first x for last
case:
x y x y z
x y z y z
**
we can split each z then for each block do right to left but we do block left to right
we will also highlight 1 x
for case like x z y z
then we just need to remove everything so the left of the comp is x
will this work??
**
*/
#include "Bruno.h"
#include<iostream>
#include<cassert>
#include <vector>
using namespace std;
namespace {
int variable_example = 0;
int FunctionExample(int P) { return 1 - P; }
}
void Bruno(int N, int L,vector<int> A){
int found=0,x=-1;
vector<int>done(N,0);
for(int i=0;i<L;i++){
if(A[i]){
int cur=i-1;
while(!A[cur]&&cur>=0){
if(done[cur])break;
Remove(cur);
done[cur]=1;
cur--;
}
if(found&&!done[i]){
//if(done[i])assert(0);
Remove(i),done[i]=1;
}
else x=i;
}
found|=A[i];
}
if(x!=-1)Remove(x),done[x]=1;
for(int i=0;i<N;i++)if(!done[i])Remove(i);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |