QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#20343#2351. Lost in Transferlinmuhan#0 4ms3384kbC++201.1kb2022-02-15 18:56:302023-01-17 09:29:34

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-17 09:29:34]
  • 评测
  • 测评结果:0
  • 用时:4ms
  • 内存:3384kb
  • [2022-02-15 18:56:30]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int N = 120;
string sys; int T, n, a[N], S;
int BIT = 8;
int main () {
	cin >> sys;
	if (sys[0] == 't') {
		cin >> T;
		while (T --) {
			cin >> n; for (int i=1;i<=n;i++) cin >> a[i];
			S = 0;
			for (int i=1;i<=n;i++) S ^= a[i];
			sort (a + 1, a + n + 1); int l = 1, r = n;
			for (int i=0;i<=8;i++) {
				if (S & 1) {
					cout << a[l] << " " << a[l + 1] << " ";
					l += 2;
				} else {
					cout << a[r] << " " << a[r - 1] << " ";
				}
			}
			for (int i=l;i<=r;i++) cout << a[i] << " ";
			cout << endl;
		}
	} else {
		cin >> T;
		while (T --) {
			cin >> n; for (int i=1;i<=n;i++) cin >> a[i];
			for (int i=1;i<=18;i+=2) {
				if (a[i] < a[i + 1]) {
					if (a[i + 1] < a[i + 2]) S |= (1 << (i - 1));
					else i --, S |= (1 << (i - 1));
				} else {
					if (a[i + 1] > a[i + 2]) ;
					else i --;
				}
			}
			int TS = 0;
			for (int i=1;i<=n;i++) TS ^= a[i];
			TS ^= S;
			if (! TS) {
				for (int i=1;i<=n;i++) cout << a[i] << " "; puts ("");
			} else {
				for (int i=1;i<=n;i++) cout << a[i] << " "; cout << TS << " "; puts ("");
			}
		}
	}
}

详细

Test #1:

score: 0
Wrong Answer
time: 4ms
memory: 3384kb

input:

transmit
2
20 97 388 459 467 32 99 98 296 403 325 330 271 87 333 378 267 405 58 426 374
20 125 481 451 150 495 136 444 192 118 26 68 281 120 61 494 339 86 292 100 32

output:

32 58 87 97 98 99 267 271 296 325 330 333 374 378 388 403 405 426 459 467 
26 32 61 68 86 100 118 120 125 136 150 192 281 292 339 444 451 481 494 495 

input:

recover
2
19 32 58 87 97 98 99 267 271 296 325 330 333 374 378 388 403 405 426 459 
19 26 32 61 68 100 118 120 125 136 150 192 281 292 339 444 451 481 494 495 

output:

32 58 87 97 98 99 267 271 296 325 330 333 374 378 388 403 405 426 459 87289 
26 32 61 68 100 118 120 125 136 150 192 281 292 339 444 451 481 494 495 87342 

result:

wrong answer incorrect answer. (test case 1)