QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#577103 | #9237. Message | goj_bot1 | 100 ✓ | 197ms | 4148kb | C++20 | 2.4kb | 2024-09-20 07:58:52 | 2024-09-20 07:58:52 |
Judging History
answer
#include "message.h"
#ifdef LOCAL
#include "stdafx.h"
#else
#include <bits/stdc++.h>
#define IL inline
#define LL long long
#define eb emplace_back
#define sz(v) ((int) (v).size())
#define L(i, j, k) for (int i = (j); i <= (k); ++i)
#define R(i, j, k) for (int i = (j); i >= (k); --i)
#define FIO(FILE) freopen(FILE".in", "r", stdin), freopen(FILE".out", "w", stdout)
using namespace std;
using vi = vector<int>;
#endif
namespace {
constexpr int N = 1024;
constexpr int L = 31;
constexpr int P = 66;
int n;
bool occ[P][L];
vector<bool> pkg[P];
int to[L];
bool vis[L], ban[L];
}
void send_message (vector<bool> M, vector<bool> C) {
n = sz(M);
M.resize(N + 1);
L (i, n + 1, N) {
M[i] = true;
}
L (i, 0, P - 1) {
pkg[i].assign(L, false);
L (j, 0, L - 1) {
occ[i][j] = false;
}
}
L (i, 0, L - 1) if (!C[i]) {
int p = (i + 1) % L, d = 1;
while (C[p]) {
p = (p + 1) % L;
++d;
}
L (j, 0, d - 1) {
occ[j][i] = true;
pkg[j][i] = (j == d - 1);
}
}
int cur = 0;
L (i, 0, L - 1) if (!C[i]) {
L (j, 0, P - 1) {
if (!occ[j][i]) {
pkg[j][i] = M[cur++];
}
}
}
for (auto v : pkg) {
send_packet(v);
}
}
vector<bool> receive_message(vector<vector<bool>> R) {
L (i, 0, L - 1) {
L (j, 0, P - 1) {
if (R[j][i]) {
to[i] = (i + j + 1) % L;
break;
}
}
}
vi path;
L (i, 0, L - 1) {
vis[i] = false;
}
L (s, 0, L - 1) {
if (vis[s]) {
continue;
}
path.clear();
int x = s;
while (!vis[x]) {
vis[x] = true;
path.eb(x);
x = to[x];
}
int p = find(path.begin(), path.end(), x) - path.begin();
if (sz(path) - p == 16) {
L (i, 0, L - 1) {
ban[i] = true;
}
L (i, p, sz(path) - 1) {
ban[path[i]] = false;
}
break;
}
}
L (i, 0, P - 1) {
L (j, 0, L - 1) {
occ[i][j] = false;
}
}
L (i, 0, L - 1) if (!ban[i]) {
int p = (i + 1) % L, d = 1;
while (ban[p]) {
p = (p + 1) % L;
++d;
}
L (j, 0, d - 1) {
occ[j][i] = true;
}
}
vector<bool> ans;
L (i, 0, L - 1) if (!ban[i]) {
L (j, 0, P - 1) {
if (!occ[j][i]) {
ans.eb(R[j][i]);
}
}
}
int l = N;
while (ans[l]) {
--l;
}
ans.resize(l);
return ans;
}
// I love WHQ!
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 158ms
memory: 3840kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #2:
score: 10
Accepted
time: 159ms
memory: 4072kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #3:
score: 10
Accepted
time: 187ms
memory: 3876kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #4:
score: 10
Accepted
time: 197ms
memory: 4072kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #5:
score: 10
Accepted
time: 150ms
memory: 3884kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #6:
score: 10
Accepted
time: 101ms
memory: 3848kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #7:
score: 10
Accepted
time: 96ms
memory: 3836kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Subtask #2:
score: 90
Accepted
Test #8:
score: 90
Accepted
time: 142ms
memory: 4076kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #9:
score: 90
Accepted
time: 159ms
memory: 3844kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #10:
score: 90
Accepted
time: 175ms
memory: 3908kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #11:
score: 90
Accepted
time: 133ms
memory: 3788kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #12:
score: 90
Accepted
time: 180ms
memory: 4084kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #13:
score: 90
Accepted
time: 142ms
memory: 3816kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #14:
score: 90
Accepted
time: 78ms
memory: 3780kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #15:
score: 90
Accepted
time: 131ms
memory: 4148kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #16:
score: 90
Accepted
time: 138ms
memory: 3836kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #17:
score: 90
Accepted
time: 142ms
memory: 4136kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #18:
score: 90
Accepted
time: 150ms
memory: 3848kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #19:
score: 90
Accepted
time: 147ms
memory: 3796kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #20:
score: 90
Accepted
time: 163ms
memory: 3844kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #21:
score: 90
Accepted
time: 151ms
memory: 4072kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #22:
score: 90
Accepted
time: 163ms
memory: 3808kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #23:
score: 90
Accepted
time: 175ms
memory: 3852kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #24:
score: 90
Accepted
time: 172ms
memory: 3852kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #25:
score: 90
Accepted
time: 149ms
memory: 3888kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #26:
score: 90
Accepted
time: 130ms
memory: 3808kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #27:
score: 90
Accepted
time: 150ms
memory: 4052kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Extra Test:
score: 0
Extra Test Passed