제출 #1120992

#제출 시각아이디문제언어결과실행 시간메모리
1120992woohyun_jng메시지 (IOI24_message)C++17
0 / 100
927 ms656 KiB
#include "message.h" using namespace std; void send_message(vector<bool> M, vector<bool> C) { vector<bool> A(31, 0); vector<int> B; for (int i = 0; i < 31; i++) { fill(A.begin(), A.end(), !C[i]); send_packet(A); if (!C[i]) B.push_back(i); if (B.size() == 5) { for (int j = i + 1; j < 31; j++) { if (!C[j]) { B.push_back(j); continue; } for (int k = 0; k < 5; k++) A[B[k]] = j & (1 << k); send_packet(A); } break; } } int S = M.size(); for (int j = 0; j < 10; j++) A[B[j]] = S & (1 << j); send_packet(A); for (int i = 0; i < (S + 15) / 16; i++) { for (int j = 0; j < 16 && 16 * i + j < S; j++) A[B[j]] = M[16 * i + j]; send_packet(A); } } vector<bool> receive_message(vector<vector<bool>> R) { vector<bool> res, C(31, 1); vector<int> cor, nt; int cnt = 0, val, S = 0; for (int i = 0; i < R.size(); i++) { cnt = 0; for (bool j : R[i]) cnt += j; if (cnt >= 16) cor.push_back(i); else nt.push_back(i); if (cor.size() == 5) { for (int j = i; j < 20; j++) { val = 0; for (int k = 4; k >= 0; k--) val = val << 1 | R[j][cor[k]]; nt.push_back(val); } } } for (int i : nt) C[i] = 0; for (int i = 0; i < 31; i++) if (C[i]) cor.push_back(i); for (int i = 9; i >= 0; i--) S = S << 1 | R[20][cor[i]]; for (int i = 21; i < R.size(); i++) for (int j = 0; j < 16; j++) if ((i - 21) * 16 + j < S) res.push_back(R[i][cor[j]]); return res; }

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

message.cpp: In function 'std::vector<bool> receive_message(std::vector<std::vector<bool> >)':
message.cpp:46:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<bool> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |     for (int i = 0; i < R.size(); i++) {
      |                     ~~^~~~~~~~~~
message.cpp:74:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<bool> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   74 |     for (int i = 21; i < R.size(); i++)
      |                      ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...