QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#89028#5742. Garbage Disposalchiranko#TL 101ms3408kbC++14496b2023-03-18 13:18:562023-03-18 13:18:59

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-18 13:18:59]
  • 评测
  • 测评结果:TL
  • 用时:101ms
  • 内存:3408kb
  • [2023-03-18 13:18:56]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;

int main()
{
//	ios::sync_with_stdio(false);
//	cin.tie(0);
	int T;cin>>T;
	while(T--)
	{
		int l,r;cin>>l>>r;
		if(l==r&&l==1)cout<<"1\n";
		else if(l==r)cout<<"-1\n";
		else if((r-l)%2==0&&l%2==0)cout<<"-1\n";
		else
		{
			int now=l;
			while(now+2<r)
			{
				cout<<now+1<<' '<<now<<' ';
				now+=2;
			}
			if(now+2==r)cout<<now+1<<' '<<now+2<<' '<<now<<"\n";
			else cout<<now+1<<' '<<now<<"\n";
		}
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3404kb

input:

3
1 5
10 13
100 100

output:

2 1 4 5 3
11 10 13 12
-1

result:

ok 3 cases (3 test cases)

Test #2:

score: 0
Accepted
time: 0ms
memory: 3316kb

input:

2
1 1
10 12

output:

1
-1

result:

ok 2 cases (2 test cases)

Test #3:

score: 0
Accepted
time: 2ms
memory: 3324kb

input:

2
9 13
3 9

output:

10 9 12 13 11
4 3 6 5 8 9 7

result:

ok 2 cases (2 test cases)

Test #4:

score: 0
Accepted
time: 18ms
memory: 3400kb

input:

1995
98 155
50 112
64 145
20 54
30 103
81 82
63 145
40 45
61 99
78 99
18 51
13 25
59 140
68 149
64 136
68 91
39 64
95 150
9 77
60 158
68 97
51 111
54 98
69 123
19 91
1 24
89 171
20 80
79 131
38 115
1 72
22 87
27 55
34 132
22 54
3 10
45 139
89 139
22 25
62 155
96 102
61 92
12 40
95 193
52 96
19 72
74...

output:

99 98 101 100 103 102 105 104 107 106 109 108 111 110 113 112 115 114 117 116 119 118 121 120 123 122 125 124 127 126 129 128 131 130 133 132 135 134 137 136 139 138 141 140 143 142 145 144 147 146 149 148 151 150 153 152 155 154
-1
65 64 67 66 69 68 71 70 73 72 75 74 77 76 79 78 81 80 83 82 85 84 8...

result:

ok 1995 cases (1995 test cases)

Test #5:

score: 0
Accepted
time: 11ms
memory: 3308kb

input:

3904
968371485 968371509
701765963 701765970
549469142 549469161
619248225 619248243
427650297 427650314
881057515 881057554
339671073 339671118
868458958 868458991
114108035 114108078
452441415 452441459
293666096 293666097
947100230 947100278
884912210 884912225
655580789 655580816
741243970 74124...

output:

968371486 968371485 968371488 968371487 968371490 968371489 968371492 968371491 968371494 968371493 968371496 968371495 968371498 968371497 968371500 968371499 968371502 968371501 968371504 968371503 968371506 968371505 968371508 968371509 968371507
701765964 701765963 701765966 701765965 701765968 ...

result:

ok 3904 cases (3904 test cases)

Test #6:

score: 0
Accepted
time: 61ms
memory: 3408kb

input:

18198
138241663 138241672
676972526 676972530
867876844 867876846
913955531 913955534
469993046 469993048
39688638 39688643
385261575 385261579
219784069 219784069
421044508 421044509
944566390 944566399
315592591 315592593
669733711 669733712
162886080 162886082
639609426 639609435
253660314 253660...

output:

138241664 138241663 138241666 138241665 138241668 138241667 138241670 138241669 138241672 138241671
-1
-1
913955532 913955531 913955534 913955533
-1
39688639 39688638 39688641 39688640 39688643 39688642
385261576 385261575 385261578 385261579 385261577
-1
421044509 421044508
944566391 944566390 9445...

result:

ok 18198 cases (18198 test cases)

Test #7:

score: 0
Accepted
time: 101ms
memory: 3320kb

input:

33298
777553849 777553849
334785771 334785773
573997215 573997216
138324260 138324264
802919250 802919253
965739697 965739697
791382357 791382357
510284693 510284693
7617431 7617434
344396965 344396966
776009722 776009725
934122341 934122342
456295677 456295677
637264010 637264014
915858631 91585863...

output:

-1
334785772 334785773 334785771
573997216 573997215
-1
802919251 802919250 802919253 802919252
-1
-1
-1
7617432 7617431 7617434 7617433
344396966 344396965
776009723 776009722 776009725 776009724
934122342 934122341
-1
-1
915858632 915858631 915858634 915858635 915858633
831424102 831424103 8314241...

result:

ok 33298 cases (33298 test cases)

Test #8:

score: -100
Time Limit Exceeded

input:

100000
450870929 450870929
501636706 501636706
821521310 821521310
505533172 505533172
86310682 86310682
271914160 271914160
87365014 87365014
346659996 346659996
96507146 96507146
359291557 359291557
278510610 278510610
34039227 34039227
247994589 247994589
620007867 620007867
13110207 13110207
403...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result: