Submission #651098

#TimeUsernameProblemLanguageResultExecution timeMemory
651098TimDeeFlight to the Ford (BOI22_communication)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
pair<int,int> decode(int n) {
    mt19937 rng(n);
    int x=rng();
    if (x&1) {
        for (int i=0; i<100; ++i) {
            int f=receive(), s=receive();
            if (f==s) {
                if (f==0) return {1,2};
                else return {2,3};
            }
        }
    } else {
        for (int i=0; i<100; ++i) {
            int f=receive(), s=receive();
            if (f==s) {
                if (f==1) return {1,2};
                else return {2,3};
            }
        }
    }
    x=rng();
    if (x&1) return {1,3};
    else return {2,3};
}

void encode(int n, int x) {
    mt19937 rng(n);
    int p=rng();
    if (p&1) {
        for (int i=0; i<100; ++i) {
            if (x<=2) send(0);
            else send(1);
            if (x<=2) send(0);
            else send(1);
        }
    } else {
        for (int i=0; i<100; ++i) {
            if (x>=2) send(0);
            else send(1);
            if (x>=2) send(0);
            else send(1);
        }
    }
}

Compilation message (stderr)

communication.cpp:2:1: error: 'pair' does not name a type
    2 | pair<int,int> decode(int n) {
      | ^~~~
communication.cpp: In function 'void encode(int, int)':
communication.cpp:28:5: error: 'mt19937' was not declared in this scope; did you mean 'std::mt19937'?
   28 |     mt19937 rng(n);
      |     ^~~~~~~
      |     std::mt19937
In file included from /usr/include/c++/10/random:49,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:108,
                 from communication.cpp:1:
/usr/include/c++/10/bits/random.h:1567:37: note: 'std::mt19937' declared here
 1567 |     0xefc60000UL, 18, 1812433253UL> mt19937;
      |                                     ^~~~~~~
communication.cpp:29:11: error: 'rng' was not declared in this scope
   29 |     int p=rng();
      |           ^~~
communication.cpp:32:23: error: 'send' was not declared in this scope
   32 |             if (x<=2) send(0);
      |                       ^~~~
communication.cpp:33:18: error: 'send' was not declared in this scope
   33 |             else send(1);
      |                  ^~~~
communication.cpp:34:23: error: 'send' was not declared in this scope
   34 |             if (x<=2) send(0);
      |                       ^~~~
communication.cpp:35:18: error: 'send' was not declared in this scope
   35 |             else send(1);
      |                  ^~~~
communication.cpp:39:23: error: 'send' was not declared in this scope
   39 |             if (x>=2) send(0);
      |                       ^~~~
communication.cpp:40:18: error: 'send' was not declared in this scope
   40 |             else send(1);
      |                  ^~~~
communication.cpp:41:23: error: 'send' was not declared in this scope
   41 |             if (x>=2) send(0);
      |                       ^~~~
communication.cpp:42:18: error: 'send' was not declared in this scope
   42 |             else send(1);
      |                  ^~~~