QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#819138#9237. Messagele0n#53.893 218ms4068kbC++202.7kb2024-12-18 13:00:442024-12-18 13:00:44

Judging History

你现在查看的是最新测评结果

  • [2024-12-18 13:00:44]
  • 评测
  • 测评结果:53.893
  • 用时:218ms
  • 内存:4068kb
  • [2024-12-18 13:00:44]
  • 提交

answer

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

using namespace std;

void work(vector<bool> C)
{
    vector<bool> A;
    vector<int> pos;
    int p = 0, i, d;
    for(i = 0; i < 31; i++)
    	A.emplace_back(C[0]);
    send_packet(A);
    p = 1;
    if(!C[0])
    	pos.emplace_back(0);
    while(p < 31)
    {
    	if(pos.size() == 16)
    		break;
    	if(p - pos.size() == 15)
    	{
    		while(p < 31)
    			pos.emplace_back(p++);
    		break;
    	}
    	for(i = 0; i < 31; i++)
			A[i] = 0;
    	d = 0;
    	while(p < 31 && d < pos.size())
    	{
    		A[pos[d]] = C[p];
    		if(!C[p])
    			pos.emplace_back(p);
    		p++;
    		d++;
    	}
    	if(2 * (16 - pos.size()) > 31 - p)
    	{
    		// cerr << "!" << p << endl;
    		for(i = p; i < 31; i++)
    			A[i] = C[p];
    		if(!C[p])
    			pos.emplace_back(p);
    		p++;
    	}
    	send_packet(A);
    }
}
void send_message(std::vector<bool> M, std::vector<bool> C)
{
    M.emplace_back(1);
    while(M.size() & 15)
        M.emplace_back(0);
    int i, j, n = M.size(), p = 0;
    vector<bool> A;
    work(C);
    for(i = 0; i < n / 16; i++)
    {
        A.clear();
        for(j = 0; j < 31; j++)
            if(C[j])
                A.emplace_back(0);
            else
                A.emplace_back(M[p++]);
        send_packet(A);
    }
}

int solve(vector<vector<bool>> R, vector<bool> &C)
{
	int p = 0, i, d, c, x;
	vector<int> pos;
	c = 0;
	for(auto o: R[0])
		c += o;
	C[0] = (c > 15);
	if(!C[0])
		pos.emplace_back(0);
	p = x = 1;
	while(p < 31)
    {
    	if(pos.size() == 16)
    	{
    		while(p < 31)
    			C[p++] = 1;
    		break;
    	}
    	if(p - pos.size() == 15)
    	{
    		while(p < 31)
    		{
    			C[p] = 0;
    			pos.emplace_back(p++);
    		}
    		break;
    	}
    	d = 0;
    	while(p < 31 && d < pos.size())
    	{
    		C[p] = R[x][pos[d]];
    		if(!C[p])
    			pos.emplace_back(p);
    		p++;
    		d++;
    	}
    	if(2 * (16 - pos.size()) > 31 - p)
    	{
    		// cerr << "?" << p << endl;
    		c = 0;
    		for(i = p; i < 31; i++)
    			c += R[x][i];
    		C[p] = (2 * c > 31 - p);
    		if(!C[p])
    			pos.emplace_back(p);
    		p++;
    	}
    	x++;
    }
    return x;
}
std::vector<bool> receive_message(std::vector<std::vector<bool>> R)
{
	// cerr << "WOW" << endl;
    int i, j, c, x;
    vector<bool> C, M;
    C.resize(31);
    x = solve(R, C);
    // cerr << "DAMN" << endl;
    for(i = x; i < R.size(); i++)
    {
        for(j = 0; j < 31; j++)
            if(!C[j])
                M.emplace_back(R[i][j]);
    }
    while(!M.back())
        M.pop_back();
    M.pop_back();
    return M;
}

详细

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 48ms
memory: 3752kb

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: 23ms
memory: 3992kb

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: 38ms
memory: 3980kb

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: 20ms
memory: 3696kb

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: 32ms
memory: 3700kb

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: 13ms
memory: 4052kb

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: 21ms
memory: 4056kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

1

result:

points 1.0

Subtask #2:

score: 43.893
Acceptable Answer

Test #8:

score: 53.883
Acceptable Answer
time: 186ms
memory: 4008kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

0.5987

result:

points 0.5987

Test #9:

score: 73.305
Acceptable Answer
time: 114ms
memory: 3984kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

0.8145

result:

points 0.8145

Test #10:

score: 56.718
Acceptable Answer
time: 218ms
memory: 3980kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

0.6302

result:

points 0.6302

Test #11:

score: 59.706
Acceptable Answer
time: 151ms
memory: 3796kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

0.6634

result:

points 0.6634

Test #12:

score: 62.847
Acceptable Answer
time: 162ms
memory: 4008kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

0.6983

result:

points 0.6983

Test #13:

score: 51.192
Acceptable Answer
time: 160ms
memory: 3800kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

0.5688

result:

points 0.5688

Test #14:

score: 43.893
Acceptable Answer
time: 82ms
memory: 4068kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

0.4877

result:

points 0.4877

Test #15:

score: 53.883
Acceptable Answer
time: 120ms
memory: 4060kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

0.5987

result:

points 0.5987

Test #16:

score: 53.883
Acceptable Answer
time: 160ms
memory: 3948kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

0.5987

result:

points 0.5987

Test #17:

score: 90
Accepted
time: 33ms
memory: 4060kb

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: 57ms
memory: 3784kb

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: 59ms
memory: 4052kb

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: 91ms
memory: 3744kb

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: 80ms
memory: 3712kb

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: 90ms
memory: 3772kb

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: 192ms
memory: 3996kb

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: 136ms
memory: 3952kb

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: 115ms
memory: 3796kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

1

result:

points 1.0

Test #26:

score: 59.706
Acceptable Answer
time: 211ms
memory: 3820kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

0.6634

result:

points 0.6634

Test #27:

score: 62.847
Acceptable Answer
time: 185ms
memory: 3828kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

0.6983

result:

points 0.6983