# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1099813 | 2024-10-12T05:22:55 Z | model_code | Message (IOI24_message) | C++17 | 1143 ms | 1056 KB |
// partially_correct/badawy_m_20.cpp #include "message.h" #include <bits/stdc++.h> using namespace std; const int BITS=31; void send_message(std::vector<bool> message, std::vector<bool> positions) { int ind=-1; for(int i=0;i<BITS;i++) { if(positions[i] == 0 && positions[i] == positions[(i+1)%BITS]) { ind=i; break; } } for(int i=0;i<5;i++) { send_packet(vector<bool>(BITS, (ind&(1<<i))?1:0)); } for(int i=0;i<positions.size()/2;i++) { vector<bool> msg(BITS,0); msg[ind]=positions[i*2]; msg[(ind+1)%BITS]=positions[i*2+1]; send_packet(msg); } int rounds = (message.size()+5+15)/16; int rem = (rounds*16) - (message.size()+5); vector<bool> sent_bits; for(int i=0;i<5;i++) sent_bits.push_back((rem&(1<<i))?1:0); for(int i=0;i<message.size();i++) sent_bits.push_back(message[i]); for(int i=0;i<rem;i++) sent_bits.push_back(0); vector<int> allies; for(int i=0;i<BITS;i++) if(positions[i] == 0) allies.push_back(i); for(int i=0;i<(int)sent_bits.size();i+=16) { vector<bool> msg(BITS); for(int j=0;j<16;j++) { msg[allies[j]] = sent_bits[i + j]; } send_packet(msg); } return; } std::vector<bool> receive_message(std::vector<std::vector<bool>> received_bits) { int ind=0; for(int i=0;i<5;i++) { sort(received_bits[i].begin(), received_bits[i].end()); if(received_bits[i][15]) ind|=(1<<i); } int co=15; vector<int> positions(BITS); for(int i=5;i<5+15;i++) { int cind = (i-5)*2; positions[cind] = received_bits[i][ind]; positions[cind+1] = received_bits[i][(ind+1)%BITS]; co-=positions[cind]; co-=positions[cind+1]; } positions.back() = co; vector<int> allies; for(int i=0;i<BITS;i++) { if(positions[i] == 0) allies.push_back(i); } vector<bool> sent_bits; for(int i=5+15;i<received_bits.size();i++) { for(int j:allies) sent_bits.push_back(received_bits[i][j]); } int rem=0; for(int i=0;i<5;i++) if(sent_bits[i]) rem|=(1<<i); vector<bool> res; for(int i=5;i<sent_bits.size();i++) res.push_back(sent_bits[i]); while(rem--) res.pop_back(); return res; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 920 KB | Used 21 days |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 334 ms | 792 KB | Used 25 days |
2 | Correct | 325 ms | 796 KB | Used 25 days |
3 | Correct | 355 ms | 1056 KB | Used 25 days |
4 | Correct | 341 ms | 988 KB | Used 24 days |
5 | Correct | 230 ms | 812 KB | Used 25 days |
6 | Correct | 182 ms | 812 KB | Used 25 days |
7 | Correct | 224 ms | 1052 KB | Used 25 days |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 920 KB | Used 21 days |
2 | Correct | 334 ms | 792 KB | Used 25 days |
3 | Correct | 325 ms | 796 KB | Used 25 days |
4 | Correct | 355 ms | 1056 KB | Used 25 days |
5 | Correct | 341 ms | 988 KB | Used 24 days |
6 | Correct | 230 ms | 812 KB | Used 25 days |
7 | Correct | 182 ms | 812 KB | Used 25 days |
8 | Correct | 224 ms | 1052 KB | Used 25 days |
9 | Partially correct | 1143 ms | 1000 KB | Used 85 days |
10 | Partially correct | 791 ms | 832 KB | Used 84 days |
11 | Partially correct | 1090 ms | 828 KB | Used 85 days |
12 | Partially correct | 1010 ms | 824 KB | Used 84 days |
13 | Partially correct | 1075 ms | 800 KB | Used 84 days |
14 | Partially correct | 752 ms | 828 KB | Used 85 days |
15 | Partially correct | 576 ms | 820 KB | Used 85 days |
16 | Partially correct | 806 ms | 800 KB | Used 85 days |
17 | Partially correct | 789 ms | 804 KB | Used 84 days |
18 | Correct | 317 ms | 824 KB | Used 27 days |
19 | Correct | 431 ms | 800 KB | Used 33 days |
20 | Correct | 456 ms | 820 KB | Used 40 days |
21 | Correct | 592 ms | 832 KB | Used 46 days |
22 | Correct | 638 ms | 812 KB | Used 52 days |
23 | Correct | 692 ms | 804 KB | Used 58 days |
24 | Correct | 864 ms | 824 KB | Used 65 days |
25 | Partially correct | 910 ms | 800 KB | Used 71 days |
26 | Partially correct | 939 ms | 820 KB | Used 77 days |
27 | Partially correct | 1099 ms | 808 KB | Used 83 days |
28 | Partially correct | 1109 ms | 832 KB | Used 85 days |