Submission #601604

# Submission time Handle Problem Language Result Execution time Memory
601604 2022-07-22T08:33:35 Z 이동현(#8475) Flight to the Ford (BOI22_communication) C++17
0 / 100
17 ms 292 KB
#include"communication.h"
#include <bits/stdc++.h>
using namespace std;
//
// --- Sample implementation for the task communication ---
//
// To compile this program with the sample grader, place:
//     communication.h communication_sample.cpp sample_grader.cpp
// in a single folder, then open the terminal in this directory (right-click onto an empty spot in the directory,
// left click on "Open in terminal") and enter e.g.:
//     g++ -std=c++17 communication_sample.cpp sample_grader.cpp
// in this folder. This will create a file a.out in the current directory which you can execute from the terminal
// as ./a.out
// See task statement or sample_grader.cpp for the input specification
//
int a[4] = {0, 0, 34, 98};

void encode(int N, int X) {
    for(int i = 0; i < 30; ++i){
        send((a[X] >> i) & 1);
    }
}

std::pair<int, int> decode(int N) {
    int val = 0;
    for(int i = 0; i < 30; ++i){
        val += (receive() << i);
    }
    vector<int> can;
    for(int i = 1; i <= 3; ++i){
        int lst = 0;
        for(int j = 0; j < 6; ++j){
            if(((val >> j) & 1) ^ ((a[i] >> j) & 1)){
                if(lst){
                    lst = -1;
                    break;
                }
                lst = 1;
            }
            else{
                lst = 0;
            }
        }
        if(lst != -1){
            can.push_back(i);
        }
    }
    if(!(1 <= (int)can.size() && (int)can.size() <= 2)) while(true) cout <<"SDF";
    if((int)can.size() == 1) return {can[0], 2};
    return {can[0], can[1]};
}
# Verdict Execution time Memory Grader output
1 Failed 17 ms 200 KB Length of token exceeds 33554432, token is 'SDFSDFSDFSDFSDFSDFSDFSDFSDFSDF...FSDFSDFSDFSDFSDFSDFSDFSDFSDFSDF...' (instance_decoder_0)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 292 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -