Submission #1038629

# Submission time Handle Problem Language Result Execution time Memory
1038629 2024-07-30T03:54:38 Z 12345678 Flight to the Ford (BOI22_communication) C++17
0 / 100
618 ms 2740 KB
#include"communication.h"
#include <bits/stdc++.h>

using namespace std;

void encode(int N, int X) {
    int cnt=0;
    X=X%3;
    for (int i=1; i<=250; i++)
    {
        if ((cnt%3)==X) cnt+=send(1);
        else cnt+=send(0);
    }
}

std::pair<int, int> decode(int N) {
    int cnt=0;
    vector<int> sm(3);
    for (int i=1; i<=250; i++)
    {
        cnt+=receive();
        sm[cnt%3]++;
    }
    vector<pair<int, int>> v;
    for (int i=0; i<3; i++) v.push_back({sm[i], (i==0)?3:i});
    sort(v.begin(), v.end());
    return {v[0].second, v[0].second};
}
# Verdict Execution time Memory Grader output
1 Correct 113 ms 2740 KB Output is correct
2 Incorrect 85 ms 332 KB Not correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 618 ms 332 KB Not correct
2 Halted 0 ms 0 KB -