답안 #1102340

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1102340 2024-10-18T02:54:26 Z ezzzay 메시지 (IOI24_message) C++17
0 / 100
582 ms 508 KB
#include "message.h"
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
void send_message(std::vector<bool> M, std::vector<bool> C) {
	vector<int>vc;
	for(int i=0;i<31;i++){
		vector<bool>v;
		if(C[i]==0)vc.pb(i);
		for(int j=0;j<31;j++){
			v.pb(C[i]);
		}
		send_packet(v);
	}
	int n= M.size();
	n%=16;
	vector<bool>v;
	for(int i=0;i<31;i++){
		if((1<<i)&n){
			v.pb(1);
		}
		else{
			v.pb(0);
		}
	}
	send_packet(v);
	
	for(int i=0;i<M.size();i+=16){
		vector<bool>v(31);
		for(int j=i;j<min(i+16,int(M.size()));j++){
			for(auto x:vc){
				v[x]=M[j];
			}
		}
		send_packet(v);
	}
	
}

std::vector<bool> receive_message(std::vector<std::vector<bool>> R) {
	vector<int>vc;
	for(int i=0;i<31;i++){
		vector<bool>v=R[i];
		sort(v.begin(),v.end());
		if(v[15]==0){
			vc.pb(i);
		}
	}
	int n=0;
	vector<bool>v=R[31];
	for(int i=0;i<31;i++){
		if(v[i]){
			n+= (1<<i);
		}
	}
	vector<bool>M;
	for(int i=32;i<R.size();i++){
		if(i==int(R.size())-1){
			for(int j=0;j<n;j++){
				M.pb(R[i][vc[j]]);
			}
			continue;
		}
		for(int j=0;j<16;j++){
			M.pb(R[i][vc[j]]);
		}
	}
	return M;
	
	
}

Compilation message

message.cpp: In function 'void send_message(std::vector<bool>, std::vector<bool>)':
message.cpp:31:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<bool>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |  for(int i=0;i<M.size();i+=16){
      |              ~^~~~~~~~~
message.cpp: In function 'std::vector<bool> receive_message(std::vector<std::vector<bool> >)':
message.cpp:60:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<bool> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |  for(int i=32;i<R.size();i++){
      |               ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 508 KB Possible tampering with sol2mgr[1]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 582 ms 424 KB decoded message is incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 508 KB Possible tampering with sol2mgr[1]
2 Halted 0 ms 0 KB -