답안 #823942

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
823942 2023-08-13T10:32:56 Z ttamx Flight to the Ford (BOI22_communication) C++17
15 / 100
32 ms 1872 KB
#include"communication.h"
#include<bits/stdc++.h>

using namespace std;

void encode(int N, int X){
    vector<int> val={0,0,6,9,15};
    for(int i=0;i<4;i++)send(val[X]>>i&1);
}

pair<int, int> decode(int N) {
    vector<vector<int>> vec(16);
    vector<int> val={0,0,6,9,15};
    vector<int> res;
    for(int i=0;i<16;i++){
        bool ok=true;
        for(int j=0;j<3;j++){
            ok&=(i>>j&3)!=3;
        }
        if(ok){
            res.emplace_back(i);
        }
    }
    int num=0;
    for(int i=0;i<4;i++)num|=receive()<<i;
    for(int i=1;i<=N;i++){
        for(auto x:res){
            vec[val[i]^x].emplace_back(i);
        }
    }
    while(vec[num].size()<2)vec[num].emplace_back(1);
    return {vec[num][0],vec[num][1]};
}
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1684 KB Output is correct
2 Correct 9 ms 1720 KB Output is correct
3 Correct 9 ms 1692 KB Output is correct
4 Correct 4 ms 1656 KB Output is correct
5 Correct 6 ms 1728 KB Output is correct
6 Correct 21 ms 1872 KB Output is correct
7 Correct 32 ms 1664 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 328 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -