Submission #1099059

#TimeUsernameProblemLanguageResultExecution timeMemory
1099059LIAFlight to the Ford (BOI22_communication)C++17
0 / 100
10 ms332 KiB
#include "communication.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; typedef vector<ll> vll; typedef vector<pll> vpll; typedef vector<vector<pll>> vvpll; typedef vector<vector<ll>> vvll; typedef vector<bool> vb; typedef vector<vector<bool>> vvb; const ll inf = 1e9 + 7; void encode(int N, int X) { vector<int> signals(3); if (X == 1) { signals[0] = 0; signals[1] = 0; signals[2] = 0; } else if (X == 2) { signals[0] = 0; signals[1] = 1; signals[2] = 0; } else if (X == 3) { signals[0] = 1; signals[1] = 0; signals[2] = 0; } for (int i = 0; i < signals.size(); ++i) { send(signals[i]); } } pair<int, int> decode(int N) { vector<int> receivedSignals(3); for (int i = 0; i < receivedSignals.size(); ++i) { receivedSignals[i] = receive(); } if (receivedSignals[0] == 0 && receivedSignals[1] == 0) { return {1, 2}; } else if (receivedSignals[0] == 0 && receivedSignals[1] == 1) { return {2, 3}; } else if (receivedSignals[0] == 1 && receivedSignals[1] == 0) { return {3, 1}; } else { return {1, 1}; } }

Compilation message (stderr)

communication.cpp: In function 'void encode(int, int)':
communication.cpp:31:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     for (int i = 0; i < signals.size(); ++i) {
      |                     ~~^~~~~~~~~~~~~~~~
communication.cpp: In function 'std::pair<int, int> decode(int)':
communication.cpp:39:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |     for (int i = 0; i < receivedSignals.size(); ++i) {
      |                     ~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...