QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#119056#6669. MapaQingyuWA 65537ms220990884kbC++231010b2023-07-04 20:05:132023-07-04 20:43:20

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-04 20:43:20]
  • 评测
  • 测评结果:WA
  • 用时:65537ms
  • 内存:220990884kb
  • [2023-07-04 20:05:13]
  • 提交

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();
}

详细

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