QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#559820 | #9237. Message | alexz1205 | 100 ✓ | 221ms | 4084kb | C++17 | 2.6kb | 2024-09-12 09:33:59 | 2024-09-12 09:33:59 |
Judging History
answer
#include <bits/stdc++.h>
#include "message.h"
using namespace std;
int arr[31];
const int LIM = 66;
namespace help{
int message[31][LIM];
}
void send_message(std::vector<bool> M, std::vector<bool> C) {
int p = -1;
int f = -1;
memset(arr, 0, sizeof(int) * 31);
memset(help::message, -1, sizeof(int) * 31*LIM);
for (int x = 0; x < 31; x ++){
if (!C[x]){
if (f == -1){
p = x;
f = x;
}else {
arr[p] = x-p;
p = x;
}
}
}
arr[p] = 31+f - p;
int c = 0;
for (int x = 0; x < 31; x ++){
if (!C[x]){
for (int i = 0; i < arr[x]-1; i ++){
help::message[x][i] = 0;
}
help::message[x][arr[x]-1] = 1;
}
}
int ind = 0;
for (int y = 0; y < LIM; y ++){
for (int x = 0; x < 31; x ++){
if (C[x]) continue;
if (help::message[x][y] != -1){
continue;
}
if (ind < (int)M.size()){
help::message[x][y] = M[ind++];
}else if (ind == (int)M.size()){
help::message[x][y] = 1;
ind ++;
}else {
help::message[x][y] = 0;
ind ++;
}
}
}
assert(ind >= (int)M.size());
for (int y = 0; y < LIM; y ++){
std::vector<bool> res;
for (int x = 0; x < 31; x ++){
res.push_back((bool)help::message[x][y]);
}
send_packet(res);
}
}
namespace check{
int good[31];
int time[31];
void dfs(int i, int t = 1){
if (good[i] != 0){
return;
}
if (time[i] != 0){
if (t - time[i] == 16){
good[i] = 1;
dfs((arr[i] + i) % 31, t+1);
return;
}else {
good[i] = -1;
return;
}
}
time[i] = t;
dfs((arr[i] + i) % 31, t+1);
if (good[i] == 0){
good[i] = -1;
}
}
}
std::vector<bool> receive_message(std::vector<std::vector<bool>> R) {
memset(arr, 0, sizeof(int) * 31);
memset(check::good, 0, sizeof(int) * 31);
memset(help::message, -1, sizeof(int) * 31*LIM);
memset(check::time, 0, sizeof(int) * 31);
for (int y = 0; y < (int)R.size(); y ++){
for (int x = 0; x < 31; x ++){
help::message[x][y] = R[y][x];
}
}
for (int x = 0; x < 31; x ++){
for (int y = 0; y < R.size(); y ++){
arr[x] ++;
if (help::message[x][y] == 1){
help::message[x][y] = -2;
break;
}
help::message[x][y] = -2;
}
}
for (int x = 0; x < 31; x ++){
if (check::good[x] != 0){
continue;
}
check::dfs(x);
}
int i = 0;
std::vector<bool> res;
for (int y = 0; y < (int)R.size(); y ++){
for (int x = 0; x < 31; x ++){
if (check::good[x] == 1){
if (help::message[x][y] == -2){
continue;
}
res.push_back(help::message[x][y]);
}
}
}
while (res.back() == 0){
res.pop_back();
}
res.pop_back();
return res;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 114ms
memory: 3864kb
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: 142ms
memory: 4012kb
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: 183ms
memory: 4080kb
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: 159ms
memory: 4012kb
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: 180ms
memory: 4004kb
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: 88ms
memory: 4032kb
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: 118ms
memory: 3800kb
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: 192ms
memory: 4024kb
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: 164ms
memory: 3980kb
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: 124ms
memory: 3980kb
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: 137ms
memory: 4020kb
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: 205ms
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: 148ms
memory: 3852kb
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: 91ms
memory: 3984kb
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: 147ms
memory: 3852kb
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: 114ms
memory: 3800kb
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: 163ms
memory: 4020kb
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: 192ms
memory: 3828kb
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: 172ms
memory: 3984kb
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: 176ms
memory: 4080kb
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: 136ms
memory: 3868kb
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: 176ms
memory: 4076kb
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: 221ms
memory: 3792kb
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: 163ms
memory: 3992kb
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: 153ms
memory: 3784kb
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: 177ms
memory: 4016kb
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: 165ms
memory: 3976kb
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