QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#87482#5742. Garbage DisposaltekolaWA 2ms3524kbC++17649b2023-03-13 10:35:572023-03-13 10:35:58

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-13 10:35:58]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3524kb
  • [2023-03-13 10:35:57]
  • 提交

answer

#include <bits/stdc++.h>

int main() {
	std::cin.tie(nullptr)->sync_with_stdio(false);
	
	int t;
	std::cin >> t;
	void solve();
	while (t--) solve();
	
	return 0;
}

void solve() {
	int l, r;
	std::cin >> l >> r;
	if (l == r) {
		if (l == 1) std::cout << "1\n";
		else std::cout << "-1\n";
	} else if (r - l & 1) {
		for (int i = l; i <= r; i++) {
			std::cout << (i == r ? l : i + 1) << " \n"[i == r];
		}
	} else if (l & 1) {
		std::cout << l + 1 << ' ' << l + r << ' ' << l << ' ';
		for (int i = l + 3; i <= r; i++) {
			std::cout << (i == r ? l : i + 1) << " \n"[i == r];
		}
	} else {
		std::cout << "-1\n";
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3524kb

input:

3
1 5
10 13
100 100

output:

2 6 1 5 1
11 12 13 10
-1

result:

wrong answer Integer element y[2] equals to 6, violates the range [1, 5] (test case 1)