QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#562494#5163. 喵了个喵oceans_of_stars15 270ms8348kbC++143.7kb2024-09-13 17:55:582024-09-13 17:56:04

Judging History

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

  • [2024-09-13 17:56:04]
  • 评测
  • 测评结果:15
  • 用时:270ms
  • 内存:8348kb
  • [2024-09-13 17:55:58]
  • 提交

answer

#include<bits/stdc++.h>
const int maxn=2e6+10;
using namespace std;
int T,n,m,k,a[maxn],cnt,pos[301],st,num[601];
deque<int>q[301];
struct lsx
{
	int id,x,y;
}ans[maxn<<1];
bool s1[601];

int get_pos(int x)
{
	return x?pos[x]:pos[n-1];
} 

int main()
{
//	freopen("meow.in","r",stdin);
//	freopen("meow.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	cin>>T;
	while(T--)
	{
		cnt=0;
		cin>>n>>m>>k;
		for(int i=1;i<=n-1;i++) pos[i]=i;st=n;
		memset(s1,0,sizeof s1);
		for(int i=1;i<=m;i++) cin>>a[i];
		if(k==2*n-2)
		{
			for(int i=1;i<=m;i++)
			{
				int d=get_pos(a[i]%(n-1));
				if(q[d].size())
				{
					if(q[d].front()==a[i])
					{
						ans[++cnt]={1,d,0};
						q[d].pop_front();
					}
					else if(q[d].back()==a[i])
					{
						ans[++cnt]={1,n,0};
						ans[++cnt]={2,d,n};
						q[d].pop_back();
					}
					else
					{
						ans[++cnt]={1,d,0};
						q[d].push_front(a[i]);
					}
				}
				else 
				{
					ans[++cnt]={1,d,0};
					q[d].push_front(a[i]);
				}
			}
		}
		else
		{
			
			for(int i=1;i<=m;i++)
			{
				int d=get_pos(a[i]%(n-1));
				if(q[d].size())
				{
					if(q[d].front()==a[i])
					{
						ans[++cnt]={1,d,0};
						q[d].pop_front();
						if(!q[d].size())s1[a[i]]=0;
					}
					else if(q[d].back()==a[i])
					{
						ans[++cnt]={1,st,0};
						ans[++cnt]={2,d,st};
						q[d].pop_back();
						s1[a[i]]=0;
					}
					else
					{
						int ss=cnt,sss=0;cnt++;
						bool flag=0;
						fill(num+1,num+601,0);
						for(int j=i+1;j<=m;j++)
						{
							if(s1[a[j]])
							{
								if(!sss) 
								{
									int d=get_pos(a[j]%(n-1));
									int dd=a[j]%(n-1);
									if(!dd)dd=n-1;
									if(q[d].size()>1&&num[q[d].front()]%2==0)
									{
										ans[++ss]={1,st,0};
										flag=1;
										ans[++cnt]={2,d,st};
										q[d].pop_back();
										s1[a[j]]=0;
										s1[q[d].back()]=1;
										i=j+1;
										break;
									}
									else
									{
										ans[++ss]={1,st,0};
										flag=1;
										ans[++cnt]={1,d,0};
										q[st].push_front(a[i]);
										swap(st,pos[dd]);
										s1[q[d].front()]=0;
										q[d].pop_front();
										s1[a[j]]=1;
										i=j+1;	
										break;
									}
								}
								else
								{
									int d=get_pos(a[j]%(n-1));
									sss=get_pos(sss);
									ans[++ss]={1,sss,0};
									flag=1;
									ans[++cnt]={1,st,0};
									ans[++cnt]={2,d,st};
									q[d].pop_back();
									if(q[d].size())s1[q[d].back()]=1;
									s1[a[j]]=0;
									i=j+1;
									break;
								}
							}
							else if(a[j]==a[i])
							{
								ans[++ss]={1,st,0};
								flag=1;
								ans[++cnt]={1,st,0};
								break;
							}
							else
							{
								int d=get_pos(a[j]%(n-1));
								num[a[i]]++;
								if(num[a[i]]%2==0)sss=a[i];
								ans[++cnt]={1,d,0};
								if(q[d].size()&&q[d].front()==a[j])q[d].pop_front();
								else q[d].push_front(a[j]);
							}
						}
					}
				}
				else
				{
					ans[++cnt]={1,d,0};
					q[d].push_front(a[i]);
					s1[a[i]]=1;
				}
			}
		}
		for(int i=1;i<n;i++)
		{
			if(!q[i].size())continue;
			for(int j=i+1;j<=n;j++)
			{
				if(!q[j].size())continue;
				if(q[i].back()==q[j].back())
				{
					ans[++cnt]={2,i,j};
					q[i].pop_back();
					q[j].pop_back();
				}
			}
		}
		int sum=0;
		for(int i=1;i<=cnt;i++) if(ans[i].id==0)sum++;
		cout<<cnt-sum<<'\n';
		for(int i=1;i<=cnt;i++)
		{
			if(ans[i].id==0)continue;
			cout<<ans[i].id<<" ";
			if(ans[i].id==1) cout<<ans[i].x<<'\n';
			else cout<<ans[i].x<<" "<<ans[i].y<<'\n';
		}
	}
	

	return 0;
}
/*
1
3 10 5
1 2 3 4 5 2 3 4 5 1
*/
 
  

詳細信息


Pretests


Final Tests

Test #1:

score: 5
Accepted
time: 268ms
memory: 5952kb

input:

1001
300 1814 598
483 60 555 101 51 354 9 252 396 527 380 573 243 98 143 305 16 355 479 117 594 369 522 368 133 534 598 353 475 161 68 250 4 119 137 12 370 532 72 152 40 314 249 182 397 71 164 513 198 539 283 121 440 548 56 439 434 64 336 132 514 339 52 350 21 421 304 156 268 87 338 419 540 583 139 ...

output:

2145
1 184
1 60
1 256
1 101
1 51
1 55
1 9
1 252
1 97
1 228
1 81
1 274
1 243
1 98
1 143
1 6
1 16
1 56
1 180
1 117
1 295
1 70
1 223
1 69
1 133
1 235
1 299
1 54
1 176
1 161
1 68
1 250
1 4
1 119
1 137
1 12
1 71
1 233
1 72
1 152
1 40
1 15
1 249
1 182
1 98
1 71
1 164
1 214
1 198
1 240
1 283
1 121
1 141
1 ...

result:

ok Right Output!!! (1001 test cases)

Test #2:

score: 5
Accepted
time: 255ms
memory: 8348kb

input:

1001
300 99724 598
345 381 76 48 555 574 99 55 233 363 511 21 268 552 390 442 284 356 291 572 132 251 185 123 247 436 410 254 74 507 567 418 421 44 597 510 151 229 98 516 591 10 70 392 562 592 236 379 349 60 485 480 71 136 222 40 546 476 113 586 444 64 540 195 583 304 423 214 221 548 224 422 341 319...

output:

120899
1 46
1 82
1 76
1 48
1 256
1 275
1 99
1 55
1 233
1 64
1 212
1 21
1 268
1 253
1 91
1 143
1 284
1 57
1 291
1 273
1 132
1 251
1 185
1 123
1 247
1 137
1 111
1 254
1 74
1 208
1 268
1 119
1 122
1 44
1 298
1 211
1 151
1 229
1 98
1 217
1 292
1 10
1 70
1 93
1 263
1 293
1 236
1 80
1 50
1 60
1 186
1 181
...

result:

ok Right Output!!! (1001 test cases)

Test #3:

score: 5
Accepted
time: 270ms
memory: 8328kb

input:

1001
300 1870 598
232 396 237 207 403 576 164 510 388 568 180 574 321 589 140 209 129 420 555 124 575 552 415 486 143 85 275 421 267 408 55 64 46 393 598 155 556 542 60 91 52 455 543 42 153 303 548 241 426 59 194 243 78 469 459 352 291 128 161 477 323 339 272 493 361 366 569 456 22 409 532 195 537 8...

output:

2209
1 232
1 97
1 237
1 207
1 104
1 277
1 164
1 211
1 89
1 269
1 180
1 275
1 22
1 290
1 140
1 209
1 129
1 121
1 256
1 124
1 276
1 253
1 116
1 187
1 143
1 85
1 275
1 122
1 267
1 109
1 55
1 64
1 46
1 94
1 299
1 155
1 257
1 243
1 60
1 91
1 52
1 156
1 244
1 42
1 153
1 4
1 249
1 241
1 127
1 59
1 194
1 24...

result:

ok Right Output!!! (1001 test cases)

Test #4:

score: 0
Runtime Error

input:

1002
2 100000 3
2 3 1 2 1 1 2 2 1 2 1 3 2 3 1 2 1 1 2 1 2 1 3 3 1 2 1 2 2 3 2 1 3 3 2 1 2 1 3 2 1 3 2 3 1 1 3 1 2 1 3 1 2 2 2 2 1 1 2 1 2 1 1 1 2 3 1 2 2 1 3 2 3 3 2 3 3 2 2 1 3 2 1 2 3 2 3 1 3 2 1 2 3 3 2 1 2 3 2 3 1 2 2 3 1 2 1 2 3 1 2 3 3 1 2 1 2 2 1 1 2 1 3 3 2 2 2 2 1 3 3 1 2 1 1 1 1 2 2 3 3 1 ...

output:

319439
1 1
1 2
1 1
2 1 2
1 1
1 1
1 1
1 1
1 2
1 1
1 2
1 2
1 1
1 2
2 2 1
1 2
1 2
1 1
1 2
1 2
1 1
1 2
1 2
1 2
1 1
2 2 1
1 2
1 1
1 1
1 1
1 2
2 2 1
1 1
1 2
2 2 1
1 2
1 2
1 1
1 2
1 2
1 1
1 1
1 1
1 1
1 2
1 1
1 2
1 1
1 2
1 2
1 1
1 1
1 1
1 2
1 1
1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
1 1
1 2
1 1
1 2
1 2
1 2
1 1
1 2
1 1
1 2
1 1
1 2
1 1
1 2
1 1
1 2
1 1
1 2
1 2
1 0
1 1
1 1
1 2
2 1 2
1 1
1 1
1 1
1 2
1 2
1 2
1 2
1 1
1 1
1 1
1 1
1 1
1 2
2 1 2
1 1
1 2
1 1
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 1
1 1
1 1
1 2
1 1
1 1
1 1
1 1
1 1
1 2
2 1 2
1 1
1 1
1 1
1 2
1 1
2 1...

result:


Test #7:

score: 0
Wrong Answer
time: 1ms
memory: 5868kb

input:

3
3 14 5
1 2 3 4 5 1 5 5 4 3 5 4 2 4
3 14 5
1 2 3 4 5 2 5 3 5 1 1 4 5 1
3 14 5
1 2 3 4 5 1 4 1 4 1 5 4 2 3

output:

13
1 1
1 2
1 0
1 2
1 1
1 3
2 1 3
1 1
1 2
1 1
1 3
1 2
2 2 3
22
1 3
1 2
1 1
1 2
1 1
1 2
1 1
1 1
1 1
1 3
1 2
1 3
2 1 3
1 2
1 1
1 2
1 1
1 3
1 1
1 1
1 2
1 3
27
1 1
1 2
1 1
1 3
1 1
1 1
1 3
1 3
1 1
1 2
1 1
1 2
1 1
1 3
1 3
1 2
1 3
1 2
1 3
1 2
1 3
1 2
1 1
1 1
1 2
1 3
2 2 3

result:

wrong answer Integer parameter [name=op] equals to 13, violates the range [14, 28] (test case 1)

Test #8:

score: 0
Wrong Answer
time: 1ms
memory: 5860kb

input:

3
3 14 5
1 2 3 4 5 4 1 1 3 2 4 1 4 5
3 14 5
1 2 3 4 5 4 3 5 3 5 1 2 3 5
3 14 5
1 2 3 4 5 5 3 2 5 5 1 2 2 4

output:

13
1 1
1 2
1 0
1 2
1 1
1 2
1 3
2 1 3
1 3
1 2
1 2
1 3
1 1
15
1 1
1 2
1 1
1 2
1 1
1 2
1 1
1 1
1 1
1 1
1 3
2 1 3
1 3
2 1 3
1 1
27
1 3
1 2
1 1
1 2
1 1
1 1
1 1
1 2
1 1
1 1
1 3
1 2
1 1
1 2
1 1
1 3
2 1 3
1 1
1 2
1 1
1 1
1 1
1 3
1 3
1 2
1 2
2 1 2

result:

wrong answer Integer parameter [name=op] equals to 13, violates the range [14, 28] (test case 1)

Test #9:

score: 0
Wrong Answer
time: 1ms
memory: 6020kb

input:

3
3 14 5
1 2 3 4 5 3 4 1 2 4 1 1 4 5
3 14 5
1 2 3 4 5 3 2 2 3 5 4 2 3 1
3 14 5
1 2 3 4 5 4 3 2 5 1 1 1 5 5

output:

14
1 1
1 2
1 3
1 2
1 1
1 3
1 2
1 1
1 3
1 2
1 1
1 2
1 1
1 3
14
1 1
1 2
1 1
1 2
1 3
1 1
1 1
1 3
1 2
1 2
1 1
1 1
1 1
2 1 2
23
1 1
1 2
1 3
1 2
1 1
1 2
1 3
1 3
1 1
1 3
1 0
1 2
1 1
1 3
2 2 3
1 3
2 1 3
1 3
1 3
1 1
1 1
1 3
1 3

result:

wrong answer Wrong Answer (test case 1)

Test #10:

score: 0
Wrong Answer
time: 1ms
memory: 5796kb

input:

3
3 14 5
1 2 3 4 5 5 2 3 1 5 3 3 5 4
3 14 5
1 2 3 4 5 4 5 2 5 5 5 5 1 3
3 14 5
1 2 3 4 5 5 5 4 5 4 4 2 3 1

output:

14
1 1
1 2
1 0
1 2
1 1
1 1
1 3
2 2 3
1 1
1 1
1 3
1 3
1 3
1 1
26
1 1
1 3
1 1
1 2
1 1
1 2
1 1
1 3
1 1
1 2
1 3
1 2
1 3
1 2
1 3
1 2
1 3
1 2
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 1
14
1 1
1 2
1 0
1 2
1 1
1 1
1 1
1 2
1 1
1 2
1 2
1 3
2 2 3
1 1

result:

wrong answer Integer parameter [name=s1] equals to 0, violates the range [1, 3] (test case 1)

Test #11:

score: 0
Runtime Error

input:

1004
3 1992 5
4 5 2 3 1 5 5 1 4 3 5 1 4 5 3 5 3 1 4 4 5 3 1 2 2 1 3 2 5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 4 2 3 1 4 2 5 1 3 2 5 1 3 4 2 1 3 4 2 1 3 5 4 1 3 5 2...

output:

352300
1 2
1 1
1 0
1 2
1 1
1 3
2 2 3
1 3
1 2
1 2
2 1 2
1 2
1 3
1 3
1 1
1 1
1 2
1 3
1 3
1 1
1 2
1 1
1 3
1 3
1 2
1 1
1 1
1 3
1 2
1 1
1 1
1 1
1 3
2 2 3
1 3
1 1
1 2
1 2
1 3
1 1
1 3
2 2 3
1 2
1 3
1 1
1 1
1 2
1 3
1 3
1 1
1 2
1 1
1 3
1 3
2 1 3
1 2
1 1
1 1
1 1
1 2
1 3
1 1
2 1 3
1 3
1 2
1 1
1 2
1 3
1 3
2 2 3...

result:


Test #15:

score: 0
Runtime Error

input:

1005
300 1908 599
161 199 80 536 40 121 528 569 337 568 8 547 86 424 333 220 439 500 210 515 593 5 75 466 537 352 372 513 451 87 554 209 261 482 415 597 450 422 182 535 484 580 506 563 200 582 101 409 135 95 51 198 587 561 514 359 112 429 435 383 418 96 266 233 331 116 293 150 289 414 130 432 377 56...

output:

2104
1 161
1 199
1 80
1 237
1 40
1 121
1 229
1 270
1 38
1 269
1 8
1 248
1 86
1 125
1 34
1 220
1 140
1 201
1 210
1 216
1 294
1 5
1 75
1 167
1 238
1 53
1 73
1 214
1 152
1 87
1 255
1 209
1 261
1 183
1 116
1 298
1 151
1 123
1 182
1 236
1 185
1 281
1 207
1 264
1 200
1 283
1 101
1 110
1 135
1 95
1 51
1 19...

result:


Test #16:

score: 0
Runtime Error

input:

1005
300 99936 599
512 185 499 176 447 476 341 332 298 68 191 231 198 536 252 220 259 113 265 438 579 284 418 212 179 467 498 105 361 170 205 273 354 104 87 201 217 427 171 152 494 382 329 535 34 186 194 146 88 32 362 372 449 573 550 553 109 292 315 278 496 225 270 237 311 470 453 375 242 269 40 24 ...

output:

3141077
1 213
1 185
1 200
1 176
1 148
1 177
1 42
1 33
1 298
1 68
1 191
1 231
1 198
1 237
1 252
1 220
1 259
1 113
1 265
1 139
1 280
1 284
1 119
1 212
1 179
1 168
1 199
1 105
1 62
1 170
1 205
1 273
1 55
1 104
1 87
1 201
1 217
1 128
1 171
1 152
1 195
1 83
1 30
1 236
1 34
1 186
1 194
1 146
1 88
1 32
1 6...

result:


Test #17:

score: 0
Runtime Error

input:

1005
300 1886 599
451 344 162 305 593 146 549 590 299 495 258 419 77 45 171 220 48 246 124 560 317 321 131 588 500 395 207 460 34 240 123 583 194 427 215 339 377 205 275 509 101 95 585 145 502 442 193 148 566 390 464 524 520 90 62 315 296 521 535 553 108 157 147 371 213 398 458 313 492 81 394 523 28...

output:

2521
1 152
1 45
1 162
1 6
1 294
1 146
1 250
1 291
1 299
1 196
1 258
1 120
1 77
1 45
1 171
1 220
1 48
1 246
1 124
1 261
1 18
1 22
1 131
1 289
1 201
1 96
1 207
1 161
1 34
1 240
1 123
1 284
1 194
1 128
1 215
1 40
1 78
1 205
1 275
1 210
1 101
1 95
1 286
1 145
1 203
1 143
1 193
1 148
1 267
1 91
1 165
1 2...

result:


Test #18:

score: 0
Runtime Error

input:

1005
300 99736 599
497 195 73 245 116 464 389 581 366 205 272 386 586 471 22 590 112 345 138 236 219 243 524 392 302 306 62 157 465 399 380 1 593 452 346 317 35 327 83 476 237 106 462 127 91 456 110 228 329 328 470 491 121 409 434 419 565 300 455 86 435 182 431 453 396 109 330 270 214 429 15 578 519...

output:

3215442
1 198
1 195
1 73
1 245
1 116
1 165
1 90
1 282
1 67
1 205
1 272
1 87
1 287
1 172
1 22
1 291
1 112
1 46
1 138
1 236
1 219
1 243
1 225
1 93
1 3
1 7
1 62
1 157
1 166
1 100
1 81
1 1
1 294
1 153
1 47
1 18
1 35
1 28
1 83
1 177
1 237
1 106
1 163
1 127
1 91
1 55
1 110
1 228
1 30
1 29
1 171
1 192
1 12...

result:


Test #19:

score: 0
Runtime Error

input:

1005
300 1966 599
291 319 439 495 23 192 348 560 588 454 219 46 564 99 322 503 272 246 350 41 284 337 335 168 573 491 50 94 59 96 413 497 590 435 327 576 33 552 68 252 597 587 557 488 128 229 135 477 506 56 451 241 224 62 370 273 466 463 332 562 513 190 585 430 403 19 382 471 507 18 141 494 574 29 2...

output:

2114
1 291
1 20
1 140
1 196
1 23
1 192
1 49
1 261
1 289
1 155
1 219
1 46
1 265
1 99
1 246
1 204
1 272
1 246
1 51
1 41
1 284
1 38
1 36
1 168
1 274
1 192
1 50
1 94
1 59
1 96
1 114
1 198
1 291
1 136
1 28
1 277
1 33
1 253
1 68
1 252
1 298
1 288
1 258
1 189
1 128
1 229
1 135
1 178
1 207
1 56
1 152
1 241
...

result:


Test #20:

score: 0
Runtime Error

input:

1005
300 1997946 599
492 539 331 519 105 510 521 334 251 416 147 16 528 224 469 253 309 53 57 567 60 502 151 533 522 283 599 355 197 484 531 527 41 274 76 561 166 47 449 219 194 465 417 571 38 126 25 94 84 596 119 18 156 402 254 148 394 88 270 326 252 310 237 327 509 374 358 259 205 460 405 22 432 4...

output:


result: