답안 #417099

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
417099 2021-06-03T11:42:43 Z tqbfjotld Ancient Machine (JOI21_ancient_machine) C++17
0 / 100
38 ms 3172 KB
#include "Anna.h"
#include <vector>
using namespace std;

///17 bits for 1st X, 17 bits for last Z, N bits for isY
void Anna(int N, std::vector<char> S) {
    int Xpos = -1;
    int Zpos = -1;
    for (int x = 0; x<N; x++){
        if (S[x]=='Z') Zpos = x;
        if (Xpos==-1 && S[x]=='X') Xpos = x;
    }
    for (int x = 16; x>=0; x--){
        Send((bool)(Xpos&(1<<x)));
    }
    for (int x = 16; x>=0; x--){
        Send((bool)(Zpos&(1<<x)));
    }
    for (int x = 0; x<N; x++){
        Send(S[x]=='Y');
    }
}

#include "Bruno.h"
#include <vector>
#include <cassert>
using namespace std;


void Bruno(int N, int L, std::vector<int> A) {
    assert(L==N+34);
    int Xpos = 0;
    int Zpos = 0;
    for (int x = 0; x<17; x++){
        Xpos = (Xpos<<1)+A[x];
    }
    for (int x = 17; x<34; x++){
        Zpos = (Zpos<<1)+A[x];
    }
    if (Xpos==(1<<17)-1 || Zpos==(1<<17)-1 || Xpos>Zpos){
        for (int x = 0; x<N; x++){
            Remove(x);
        }
        return;
    }
    for (int x = Xpos+1; x<Zpos; x++){
        if (!A[x-34]){
            Remove(x);
        }
    }
    for (int x = Xpos+1; x<Zpos; x++){
        if (A[x-34]){
            Remove(x);
        }
    }
    for (int x = 0; x<=Xpos; x++){
        Remove(x);
    }
    for (int x = Zpos; x<N; x++){
        Remove(x);
    }
}

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 496 KB Output is correct
2 Incorrect 0 ms 496 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 38 ms 3172 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -