제출 #1099056

#제출 시각아이디문제언어결과실행 시간메모리
1099056LIAFlight to the Ford (BOI22_communication)C++17
0 / 100
10 ms372 KiB
#include "communication.h" using namespace std; void encode(int N, int X) { int signals[5]; int response[5]; 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 < 3; ++i) { response[i] = send(signals[i]); } } pair<int, int> decode(int N) { int receivedSignals[3]; for (int i = 0; i < 3; ++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}; } }

컴파일 시 표준 에러 (stderr) 메시지

communication.cpp: In function 'void encode(int, int)':
communication.cpp:7:9: warning: variable 'response' set but not used [-Wunused-but-set-variable]
    7 |     int response[5];
      |         ^~~~~~~~
communication.cpp:24:27: warning: 'signals[1]' may be used uninitialized in this function [-Wmaybe-uninitialized]
   24 |         response[i] = send(signals[i]);
      |                       ~~~~^~~~~~~~~~~~
communication.cpp:24:27: warning: 'signals[0]' may be used uninitialized in this function [-Wmaybe-uninitialized]
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...