Submission #1103075

# Submission time Handle Problem Language Result Execution time Memory
1103075 2024-10-19T22:52:31 Z aaaaaarroz Message (IOI24_message) C++17
29.3175 / 100
1699 ms 1104 KB
#include <bits/stdc++.h>
using namespace std;
vector<bool> send_packet(vector<bool> A);
void send_message(vector<bool> M, vector<bool> C){
	for(int i=0;i<30;i++){
		if(C[i]==true){
			vector<bool>paquete(31,0);
			send_packet(paquete);
		}
		else{
			vector<bool>paquete(31,1);
			send_packet(paquete);
		}
	}
	vector<bool>numero(31,0);
	int bit_real=0;
	for(int i=0;i<31;i++){
		if(C[i]==1){
			continue;
		}
		if(((1<<bit_real)&(M.size()))){
			numero[i]=1;
		}
		bit_real++;
	}
	send_packet(numero);
	vector<bool>envio;
	int pos=0;
	while(pos<M.size()){
		if(C[envio.size()]==0){
			envio.push_back(M[pos]);
			pos++;
		}
		else{
			envio.push_back(0);
		}
		if(envio.size()==31){
			send_packet(envio);
			envio.clear();
		}
	}
	while(envio.size()<31){
		envio.push_back(false);
		if(envio.size()==31){
			send_packet(envio);
			break;
		}
	}
}
vector<bool> receive_message(vector<vector<bool>> R){
	vector<bool>funciona(31,false);
	int funcionales=0;
	for(int i=0;i<30;i++){
		int votos=0;
		for(int j=0;j<31;j++){
			if(R[i][j]){
				votos++;
			}
		}
		if(votos>15){
			funcionales++;
			funciona[i]=true;
		}
	}
	if(funcionales==16){
		funciona[30]=0;
	}
	else{
		funciona[30]=1;
	}
	int bit_real=0;
	int largo=0;
	for(int j=0;j<30;j++){
		if(funciona[j]){
			if(R[30][j]){
				largo+=(1<<bit_real);
			}
			bit_real++;
		}
	}
	vector<bool>sec;
	for(int i=31;i<R.size();i++){
		for(int j=0;j<31;j++){
			if(funciona[j]){
				sec.push_back(R[i][j]);
			}
		}
	}
	while(sec.size()>largo){
		sec.pop_back();
	}
	return sec;
}

Compilation message

message.cpp: In function 'void send_message(std::vector<bool>, std::vector<bool>)':
message.cpp:29:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<bool>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |  while(pos<M.size()){
      |        ~~~^~~~~~~~~
message.cpp: In function 'std::vector<bool> receive_message(std::vector<std::vector<bool> >)':
message.cpp:82:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<bool> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   82 |  for(int i=31;i<R.size();i++){
      |               ~^~~~~~~~~
message.cpp:89:18: warning: comparison of integer expressions of different signedness: 'std::vector<bool>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   89 |  while(sec.size()>largo){
      |        ~~~~~~~~~~^~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 656 KB Used 32 days
# Verdict Execution time Memory Grader output
1 Correct 645 ms 1104 KB Used 36 days
2 Correct 591 ms 832 KB Used 35 days
3 Correct 614 ms 848 KB Used 36 days
4 Correct 610 ms 844 KB Used 35 days
5 Correct 450 ms 844 KB Used 36 days
6 Correct 332 ms 828 KB Used 35 days
7 Correct 381 ms 1088 KB Used 35 days
# Verdict Execution time Memory Grader output
1 Correct 2 ms 656 KB Used 32 days
2 Correct 645 ms 1104 KB Used 36 days
3 Correct 591 ms 832 KB Used 35 days
4 Correct 614 ms 848 KB Used 36 days
5 Correct 610 ms 844 KB Used 35 days
6 Correct 450 ms 844 KB Used 36 days
7 Correct 332 ms 828 KB Used 35 days
8 Correct 381 ms 1088 KB Used 35 days
9 Partially correct 1653 ms 828 KB Used 96 days
10 Partially correct 1166 ms 832 KB Used 95 days
11 Partially correct 1699 ms 1092 KB Used 96 days
12 Partially correct 1677 ms 828 KB Used 95 days
13 Partially correct 1674 ms 920 KB Used 95 days
14 Partially correct 1180 ms 1088 KB Used 96 days
15 Partially correct 914 ms 828 KB Used 96 days
16 Partially correct 1223 ms 852 KB Used 95 days
17 Partially correct 1203 ms 840 KB Used 95 days
18 Correct 643 ms 1092 KB Used 38 days
19 Correct 720 ms 1088 KB Used 44 days
20 Correct 825 ms 1088 KB Used 50 days
21 Correct 946 ms 1096 KB Used 57 days
22 Correct 1046 ms 832 KB Used 63 days
23 Partially correct 1147 ms 852 KB Used 69 days
24 Partially correct 1288 ms 860 KB Used 75 days
25 Partially correct 1388 ms 832 KB Used 81 days
26 Partially correct 1523 ms 1088 KB Used 88 days
27 Partially correct 1671 ms 836 KB Used 94 days
28 Partially correct 1609 ms 860 KB Used 96 days