답안 #1104329

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1104329 2024-10-23T13:22:41 Z tamir1 메시지 (IOI24_message) C++17
100 / 100
1302 ms 1096 KB
#include "message.h"
#include <bits/stdc++.h>
using namespace std;

void send_message(vector<bool> M,vector<bool> C) {
	vector<vector<bool>> A(66, vector<bool> (31,0));
	int x=1-M.back(),idx=0;
	while(M.size()<=1024) M.push_back(x);
	for(int i=0;i<31;i++){
		if(!C[i]){
			int j=(i+1)%31,ix=0;
			while(C[j]){
				ix++;
				j=(j+1)%31;
			}
			A[ix][i]=1;
			for(int j=ix+1;j<66;j++){
				A[j][i]=M[idx];
				idx++;
			}
		}
	}
	for(int i=0;i<66;i++) send_packet(A[i]);
}

vector<bool> receive_message(vector<vector<bool>> R) {
	vector<int> nxt(31,0);
	vector<bool> ans={};
	bitset<31> ok;
	for(int i=0;i<31;i++){
		nxt[i]=(i+1)%31;
		for(int j=0;j<66;j++){
			if(!R[j][i]) nxt[i]=(nxt[i]+1)%31;
			else break;
		}
	}
	for(int i=0;i<31;i++){
		int x=i;
		bool unen=1;
		ok.reset();
		ok[x]=1;
		for(int j=0;j<15;j++){
			x=nxt[x];
			if(ok[x]){
				unen=0;
				break;
			}
			ok[x]=1;
		}
		if(nxt[x]==i && unen){
			for(int j=(nxt[i]-i+31)%31;j<66;j++){
				ans.push_back(R[j][i]);
			}
		}
	}
	int x=ans.back();
	while(ans.back()==x) ans.pop_back();
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 656 KB Used 66 days
# 결과 실행 시간 메모리 Grader output
1 Correct 1153 ms 924 KB Used 66 days
2 Correct 1226 ms 1096 KB Used 66 days
3 Correct 1263 ms 832 KB Used 66 days
4 Correct 1218 ms 840 KB Used 66 days
5 Correct 903 ms 832 KB Used 66 days
6 Correct 623 ms 832 KB Used 66 days
7 Correct 741 ms 856 KB Used 66 days
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 656 KB Used 66 days
2 Correct 1153 ms 924 KB Used 66 days
3 Correct 1226 ms 1096 KB Used 66 days
4 Correct 1263 ms 832 KB Used 66 days
5 Correct 1218 ms 840 KB Used 66 days
6 Correct 903 ms 832 KB Used 66 days
7 Correct 623 ms 832 KB Used 66 days
8 Correct 741 ms 856 KB Used 66 days
9 Correct 1218 ms 844 KB Used 66 days
10 Correct 1214 ms 840 KB Used 66 days
11 Correct 1240 ms 852 KB Used 66 days
12 Correct 1220 ms 836 KB Used 66 days
13 Correct 1163 ms 1096 KB Used 66 days
14 Correct 837 ms 836 KB Used 66 days
15 Correct 671 ms 836 KB Used 66 days
16 Correct 880 ms 1092 KB Used 66 days
17 Correct 871 ms 860 KB Used 66 days
18 Correct 1217 ms 1092 KB Used 66 days
19 Correct 1175 ms 1004 KB Used 66 days
20 Correct 1188 ms 848 KB Used 66 days
21 Correct 1222 ms 1092 KB Used 66 days
22 Correct 1218 ms 844 KB Used 66 days
23 Correct 1221 ms 1012 KB Used 66 days
24 Correct 1156 ms 844 KB Used 66 days
25 Correct 1223 ms 832 KB Used 66 days
26 Correct 1249 ms 864 KB Used 66 days
27 Correct 1302 ms 1096 KB Used 66 days
28 Correct 1236 ms 836 KB Used 66 days