QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#20484 | #2425. The Collection Game | BinDir0# | 0 | 11ms | 3864kb | C++20 | 1.2kb | 2022-02-16 11:32:03 | 2022-05-03 10:12:39 |
Judging History
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 , 0 , 1);
for(int i = 1 ; i <= t ; i++ )
{
for(opt qwq : q[i]) schedule(qwq.x , qwq.y);
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
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3800kb
input:
4 50 2 0 0 2 1 0 2 0 1
output:
946149565 3 4 946149565 1 2 547293220 946149565 1 3 946149565 2 4 547293220 946149565 3 4 946149565 1 2 547293220 345685428 2 4 1 3
result:
points 0.0 points 0.0 Not correct
Subtask #2:
score: 0
Wrong Answer
Test #2:
score: 0
Wrong Answer
time: 0ms
memory: 3848kb
input:
10 5000 4 0 1 1 0 2 1 0 2 1 0 4 1 0 0 1 4 0 1 1 0 2 1 0 5 0 1 1 1 0 4 1 0 0 1 4 0 1 1 0 2 1 0
output:
946149565 9 10 946149565 6 7 946149565 4 5 946149565 1 2 547293220 946149565 6 8 946149565 1 3 547293220 946149565 6 7 946149565 1 2 547293220 946149565 6 9 946149565 7 10 946149565 1 4 946149565 2 5 547293220 946149565 9 10 946149565 6 8 946149565 4 5 946149565 1 3 547293220 946149565 6 7 946149565...
result:
points 0.0 points 0.0 Not correct
Subtask #3:
score: 0
Wrong Answer
Test #10:
score: 0
Wrong Answer
time: 11ms
memory: 3864kb
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: 1ms
memory: 3700kb
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 6 8 946149565 1 3 547293220 946149565 6 7 946149565 1 2 547293220 946149565 6 9 946149565 7 10 946149565 1 4 946149565 2 5 547293220 946149565 9 10 946149565 6 8 946149565 4 5 946149565 1 3 547293220 946149565 6 7 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:
0%