QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#103183#5742. Garbage Disposalwillow#WA 2ms3612kbC++14681b2023-05-04 17:40:442023-05-04 17:40:47

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-04 17:40:47]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3612kb
  • [2023-05-04 17:40:44]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int T, l, r;
int main() {
	for(scanf("%d", &T); T --; ) {
		scanf("%d%d", &l, &r);
		if((r - l + 1) % 2 == 0) {
			for(int i = l; i <= r; ++ i) {
				if(i % 2 == l % 2)
					printf("%d ", i + 1);
				else
					printf("%d ", i - 1);
			}
			puts("");
		}
		else {
			if(l == r) {
				puts("-1");
				continue;
			}
			if(l % 2 == 0 && r % 2 == 0)
				puts("-1");
			else {
				printf("%d %d %d ", l + 1, l + 2, l);
				for(int i = l + 3; i <= r; ++ i) {
					if(i % 2 == (l + 3) % 2) {
						printf("%d ", i + 1);
					}
					else {
						printf("%d ", i - 1);
					}
				}
				puts("");
			}
		}
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3612kb

input:

3
1 5
10 13
100 100

output:

2 3 1 5 4 
11 10 13 12 
-1

result:

ok 3 cases (3 test cases)

Test #2:

score: -100
Wrong Answer
time: 2ms
memory: 3416kb

input:

2
1 1
10 12

output:

-1
-1

result:

wrong answer Jury found answer but participant didn't (test case 1)