답안 #1099811

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1099811 2024-10-12T05:22:32 Z model_code 메시지 (IOI24_message) C++17
17.4825 / 100
1458 ms 1064 KB
// partially_correct/mruxim-100day.cpp

#include "message.h"
#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0, i##__n = (int)(n); i < i##__n; ++i)
#define fer(i, a, b) for(int i = (int)(a), i##__b = (int)(b); i < i##__b; ++i)
#define rof(i, b, a) for(int i = (int)(b), i##__a = (int)(a); i-- > i##__a; )
#define sz(x) (int((x).size()))
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define X first
#define Y second
//#define endl '\n'

template<class P, class Q> inline void smin(P &a, Q b) { if (b < a) a = b; }
template<class P, class Q> inline void smax(P &a, Q b) { if (a < b) a = b; }

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;

///////////////////////////////////////////////////////////////////////////

const int plen = 31;
const int maxe = 16;

void send_message(vector<bool> M, vector<bool> C) {
	vector<vector<bool>> A(max(100, (sz(M) + 15) / 16 + 2), vector<bool>(plen, false));

	vector<int> nxt(plen, 1);
	rep(b, plen) if(!C[b])
		while(C[(b + nxt[b]) % plen]) nxt[b]++;
	rep(b, plen) if(!C[b]) A[nxt[b] - 1][b] = true;

	int pos = 0;
	rep(i, sz(A)) rep(b, plen) if(!C[b] && nxt[b] <= i)
		A[i][b] = (pos < sz(M) ? M[pos] : (pos == sz(M) ? true : false)), pos++;

	rep(i, sz(A)) send_packet(A[i]);
}

vector<bool> receive_message(vector<vector<bool>> A) {
	vector<int> nxt(plen, 0);
	rep(b, plen) rep(i, maxe) if(A[i][b]) { nxt[b] = i + 1; break; }
	vector<bool> C(plen, true);
	rep(b, plen) {
		int cnt = 0;
		vector<bool> mark(plen, false);
		for(int v = (b + nxt[b]) % plen; !mark[v]; v = (v + nxt[v]) % plen) mark[v] = true, cnt++;
		if(cnt == 16) rep(v, plen) C[v] = !mark[v];
	}

	vector<bool> M;
	rep(i, sz(A)) rep(b, plen) if(!C[b] && nxt[b] <= i)
		M.pb(A[i][b]);

	while(!M.back()) M.pop_back();
	M.pop_back();

	return M;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 664 KB Used 100 days
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1450 ms 1064 KB Used 100 days
2 Partially correct 1313 ms 828 KB Used 100 days
3 Partially correct 1453 ms 828 KB Used 100 days
4 Partially correct 1407 ms 832 KB Used 100 days
5 Partially correct 973 ms 828 KB Used 100 days
6 Partially correct 691 ms 800 KB Used 100 days
7 Partially correct 826 ms 824 KB Used 100 days
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 664 KB Used 100 days
2 Partially correct 1450 ms 1064 KB Used 100 days
3 Partially correct 1313 ms 828 KB Used 100 days
4 Partially correct 1453 ms 828 KB Used 100 days
5 Partially correct 1407 ms 832 KB Used 100 days
6 Partially correct 973 ms 828 KB Used 100 days
7 Partially correct 691 ms 800 KB Used 100 days
8 Partially correct 826 ms 824 KB Used 100 days
9 Partially correct 1378 ms 828 KB Used 100 days
10 Partially correct 1369 ms 840 KB Used 100 days
11 Partially correct 1326 ms 916 KB Used 100 days
12 Partially correct 1392 ms 832 KB Used 100 days
13 Partially correct 1458 ms 824 KB Used 100 days
14 Partially correct 987 ms 836 KB Used 100 days
15 Partially correct 711 ms 812 KB Used 100 days
16 Partially correct 1079 ms 836 KB Used 100 days
17 Partially correct 1064 ms 828 KB Used 100 days
18 Partially correct 1316 ms 832 KB Used 100 days
19 Partially correct 1377 ms 1008 KB Used 100 days
20 Partially correct 1365 ms 832 KB Used 100 days
21 Partially correct 1437 ms 836 KB Used 100 days
22 Partially correct 1347 ms 852 KB Used 100 days
23 Partially correct 1418 ms 856 KB Used 100 days
24 Partially correct 1355 ms 840 KB Used 100 days
25 Partially correct 1246 ms 844 KB Used 100 days
26 Partially correct 1270 ms 840 KB Used 100 days
27 Partially correct 1319 ms 840 KB Used 100 days
28 Partially correct 1339 ms 836 KB Used 100 days