QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#20528#2425. The Collection GameBinDir0#0 4ms3892kbC++201.3kb2022-02-16 14:34:282022-05-03 10:24:41

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-03 10:24:41]
  • 评测
  • 测评结果:0
  • 用时:4ms
  • 内存:3892kb
  • [2022-02-16 14:34:28]
  • 提交

answer

#include <bits/stdc++.h>
#include "swaps.h"
using namespace std;
int p[550] , f[550] , t;
vector< int > ans;
struct opt
{
	int x , y , d;
};
vector< opt > q[550];
void work( int x , int y , int a , int d )
{
	if(d != a) swap(p[x] , p[y]);
}
int sortbij( int l , int r , int d , int t )
{
	if(l == r) return t - 1;
	int mid = l + r >> 1 , it1 = l , it2 = mid + 1;
	while(it1 <= mid && it2 <= r)
	{
		q[t].push_back((opt){it1 , it2 , d});
		it1++; it2++;
	}
	return max(sortbij(l , mid , d , t + 1) , sortbij(mid + 1 , r , d , t + 1));
}
int sortseq( int l , int r , int d , int t )
{
	if(l == r) return t - 1;
	int mid = l + r >> 1;
	int qwq = max(sortseq(l , mid , d , t) , sortseq(mid + 1 , r , d ^ 1 , t)) + 1;
	return sortbij(l , r , d , qwq);
}
void solve( int n , int lim ) 
{
	for(int i = 1 ; i <= n ; i++ ) p[i] = i;
	t = sortseq(1 , n , 1 , 1);
	for(int i = 1 ; i <= t ; i++ )
	{
		for(opt qwq : q[i]) schedule(p[qwq.x] , p[qwq.y]);
//		for(opt qwq : q[i]) cerr << qwq.x << ' ' << qwq.y << ' ' << qwq.d << endl;
//		cerr << endl;
		ans = visit();
		for(int j = 0 ; j < q[i].size() ; j++ )
			work(q[i][j].x , q[i][j].y , q[i][j].d , ans[j]);
	}
	vector< int > q;
	for(int i = 1 ; i <= n ; i++ ) q.push_back(p[i]);
	answer(q);
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Accepted

Test #1:

score: 0
Accepted
time: 3ms
memory: 3696kb

input:

4 50
2 0 0
2 1 0
2 0 1

output:

946149565 3 4
946149565 1 2
547293220
946149565 2 3
946149565 1 4
547293220
946149565 3 1
946149565 2 4
547293220
345685428 2 4 1 3

result:

points 1.0 points  1.0 Correct

Subtask #2:

score: 0
Wrong Answer

Test #2:

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

input:

10 5000
4 0 1 1 0
2 0 1
2 0 1
4 0 1 1 0
4 0 0 1 1
2 0 0
5 1 1 1 0 0
4 0 1 1 0
4 1 0 0 1
2 0 0

output:

946149565 9 10
946149565 6 7
946149565 4 5
946149565 1 2
547293220
946149565 7 8
946149565 2 3
547293220
946149565 7 6
946149565 2 1
547293220
946149565 7 10
946149565 6 9
946149565 2 5
946149565 1 4
547293220
946149565 10 6
946149565 7 8
946149565 5 1
946149565 2 3
547293220
946149565 7 9
946149565...

result:

points 0.0 points  0.0 Not correct

Subtask #3:

score: 0
Wrong Answer

Test #10:

score: 0
Wrong Answer
time: 0ms
memory: 3892kb

input:

500 1000
244 1 0 1 1 1 0 1 0 0 1 0 0 1 0 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0 1 1 0 1 1 0 1 0 1 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 1 0 1 0 0 0 1 0 1 1 1 1 0 1 0 0 1 0 1 0 0 1 1 0 1 1 1 1 0 0 0 0 1 0 0 1 1 1 0 0 1 0 0 0 1 1 0 0 1 1 0 1 0 0 1 1 1 0 1 1 0 0 0 1 1 0 0 1 1 1 1 1 0 1 0 1 0 1 1 1 1 0 1 0 0 0 0 1 0 0 1...

output:

946149565 498 499
946149565 496 497
946149565 494 495
946149565 492 493
946149565 490 491
946149565 488 489
946149565 486 487
946149565 484 485
946149565 482 483
946149565 480 481
946149565 478 479
946149565 476 477
946149565 474 475
946149565 472 473
946149565 470 471
946149565 467 468
946149565 46...

result:

points 0.0 points  0.0 Not correct

Subtask #4:

score: 0
Wrong Answer

Test #15:

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

input:

10 5000
4 1 1 1 1
2 1 1
2 1 1
4 1 1 1 1
4 1 1 1 1
2 1 1
5 1 1 1 1 1
4 1 1 1 1
4 1 1 1 1
2 1 1

output:

946149565 9 10
946149565 6 7
946149565 4 5
946149565 1 2
547293220
946149565 7 8
946149565 1 3
547293220
946149565 8 6
946149565 1 2
547293220
946149565 6 9
946149565 8 10
946149565 1 5
946149565 2 4
547293220
946149565 6 8
946149565 9 7
946149565 5 4
946149565 1 3
547293220
946149565 7 10
946149565...

result:

points 0.0 points  0.0 Not correct

Subtask #5:

score: 0
Skipped

Dependency #4:

0%

Subtask #6:

score: 0
Skipped

Dependency #4:

0%

Subtask #7:

score: 0
Skipped

Dependency #2:

0%

Subtask #8:

score: 0
Skipped

Dependency #4:

0%

Subtask #9:

score: 0
Skipped

Dependency #3:

0%

Subtask #10:

score: 0
Skipped

Dependency #8:

0%

Subtask #11:

score: 0
Skipped

Dependency #9:

0%

Subtask #12:

score: 0
Skipped

Dependency #10:

0%

Subtask #13:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%