Submission #860713

# Submission time Handle Problem Language Result Execution time Memory
860713 2023-10-14T02:22:22 Z E869120 Flight to the Ford (BOI22_communication) C++17
15 / 100
28 ms 3532 KB
#include"communication.h"
#include <vector>
using namespace std;

void encode(int N, int X) {
    if (X == 1) { send(0); send(0); send(0); send(0); send(0); send(0); }
    if (X == 2) { send(1); send(1); send(1); send(1); send(1); send(1); }
    if (X == 3) { send(1); send(1); send(0); send(0); send(1); send(1); }
}

pair<int, int> decode(int N) {
    vector<int> List;
    List.push_back(receive());
    List.push_back(receive());
    List.push_back(receive());
    List.push_back(receive());
    List.push_back(receive());
    List.push_back(receive());

    // Check
    bool flag1 = true;
    bool flag2 = true;
    for (int i = 0; i < (int)List.size() - 1; i++) {
        if (List[i] == 1 && List[i + 1] == 1) flag1 = false;
        if (List[i] == 0 && List[i + 1] == 0) flag2 = false;
    }
    if (flag1 == false) return make_pair(2, 3);
    if (flag2 == false) return make_pair(1, 3);
    return make_pair(1, 2);
}
# Verdict Execution time Memory Grader output
1 Correct 9 ms 2892 KB Output is correct
2 Correct 7 ms 3532 KB Output is correct
3 Correct 9 ms 2964 KB Output is correct
4 Correct 4 ms 2752 KB Output is correct
5 Correct 9 ms 3240 KB Output is correct
6 Correct 23 ms 2808 KB Output is correct
7 Correct 28 ms 2768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 332 KB Not correct
2 Halted 0 ms 0 KB -