QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#119056 | #6669. Mapa | Qingyu | WA | 65537ms | 220990884kb | C++23 | 1010b | 2023-07-04 20:05:13 | 2023-07-04 20:43:20 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
string encode_integer(int x) {
string s = "";
for (int i = 0; i < 30; ++i) {
s += to_string((x >> i) & 1);
}
return s;
}
int decode_integer(string s) {
int x = 0;
for (int i = 0; i < 30; ++i) {
if (s[i] == '1') {
x |= 1 << i;
}
}
return x;
}
void encode() {
int n;
cin >> n;
string s = "";
for (int i = 0; i < n; ++i) {
int x, y;
cin >> x >> y;
s += encode_integer(x);
s += encode_integer(y);
}
cout << s.length() << '\n' << s << '\n';
}
void decode() {
int n, q, k;
cin >> n >> q >> k;
string s;
cin >> s;
map<int, int> mp;
for (int i = 0; i < n; ++i) {
int s0 = 60 * i, s1 = 60 * i + 30;
int key = decode_integer(s.substr(s0, 30));
int value = decode_integer(s.substr(s1, 30));
mp[key] = value;
}
for (int i = 0; i < q; ++i) {
int x;
cin >> x;
cout << mp[x] << '\n';
}
}
int main() {
int T;
cin >> T;
if (T == 1) encode();
else decode();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 65537ms
memory: 220990884kb
input:
1 100 495528311 963488152 269613430 443544124 700489871 792354118 151890319 506569919 180452297 13229948 684464994 543841485 978085128 903812192 238355172 441140842 28061035 783291471 530823766 718942732 936853023 439421263 201361623 226633955 304644844 778868118 864860135 461524170 88300500 6959354...\01 100 495528311 963488152 269613430 443544124 700489871 792354118 151890319 506569919 180452297 13229948 684464994 543841485 978085128 903812192 238355172 441140842 28061035 783291471 530823766 718942732 936853023 439421263 201361623 226633955 304644844 778868118 864860135 461524170 88300500 6959354...\02 100 79 6000 1110111010010100100100011011100001100110010101101101101001110110111010011111100010000000100011110001001111111101100101101111000100000101000000111001010110001010111010010111001111011111000110010101101100001001001111110100100101100011000111101001001111011110100000110101000011111011111011...\0
output:
6000 1110111010010100100100011011100001100110010101101101101001110110111010011111100010000000100011110001001111111101100101101111000100000101000000111001010110001010111010010111001111011111000110010101101100001001001111110100100101100011000111101001001111011110100000110101000011111011111011100100110...\02 100 79 6000 1110111010010100100100011011100001100110010101101101101001110110111010011111100010000000100011110001001111111101100101101111000100000101000000111001010110001010111010010111001111011111000110010101101100001001001111110100100101100011000111101001001111011110100000110101000011111011111011...\0310305144 821194635 174780370 903812192 805026231 996046536 439421263 645287342 90686849 20101025 440972097 543841485 176553522 249563964 461524170 348624865 848301562 506569919 306718453 206848250 382805509 278712030 964702808 868944393 493895143 39665197 574757075 441140842 785665865 229376884 551...\0
result:
points 0.0 ok K = 6000