QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#20453 | #2425. The Collection Game | linmuhan# | 25 | 64ms | 3840kb | C++20 | 1.1kb | 2022-02-16 10:15:01 | 2022-05-03 09:58:23 |
Judging History
answer
#include <bits/stdc++.h>
#include "swaps.h"
using namespace std;
#define sc schedule
const int NT = 1220;
int a[NT], id[NT], n, INF;
int tot; pair <int, int> sch[NT * NT];
vector <int> vf;
vector <int> ans;
void solve (int t, int v) {
for (int i=1;i<=t+1;i++) a[i] = i, id[i] = i; INF = t + 1;
for (n=1;n<t;n<<=1);
for (int i=t+1;i<=n;i++) a[i] = INF, id[i] = i;
for (int i=1;i<n;i<<=1) {
int op = 0; // 0 up 1 down
for (int p=1;p<=n;p+=i<<1,op^=1) { // now op are same
for (int t=i;t>=1;t>>=1) {
for (int j=p;j<p+(i<<1);j+=t<<1) {
tot = 0;
for (int k=j;k<t+j;k++) {
if (a[id[k]] == INF || a[id[k + t]] == INF) {
if (a[id[k]] < a[id[k + t]] == op) swap (id[k], id[k + t]);
} else sch[++ tot] = make_pair (k, k + t);
}
if (! tot) continue ;
for (int _=1;_<=tot;_++) sc (id[sch[_].first], id[sch[_].second]); vf = visit ();
// for (int _=1;_<=tot;_++) vf[_ - 1] = ! vf[_ - 1];
for (int _=1;_<=tot;_++) if (vf[_ - 1] == op) swap (id[sch[_].first], id[sch[_].second]);
}
}
}
}
for (int i=1;i<=t;i++) ans.push_back (a[id[i]]);
answer (ans);
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Accepted
Test #1:
score: 0
Accepted
time: 5ms
memory: 3724kb
input:
4 50 1 0 1 0 2 1 0 1 0 1 1
output:
946149565 1 2 547293220 946149565 3 4 547293220 946149565 2 3 946149565 1 4 547293220 946149565 2 4 547293220 946149565 3 1 547293220 345685428 4 2 3 1
result:
points 1.0 points 1.0 Correct
Subtask #2:
score: 5
Accepted
Test #2:
score: 5
Accepted
time: 3ms
memory: 3816kb
input:
10 5000 1 0 1 0 1 0 1 0 1 0 2 1 0 1 0 1 1 2 1 0 1 0 1 1 1 1 4 1 1 1 0 2 1 0 2 0 1 1 0 1 0 1 1 1 1 1 1 2 0 0 4 1 1 1 0 2 1 1 2 0 0 1 1 1 1 1 0 1 1 1 1
output:
946149565 1 2 547293220 946149565 3 4 547293220 946149565 5 6 547293220 946149565 7 8 547293220 946149565 9 10 547293220 946149565 2 3 946149565 1 4 547293220 946149565 2 4 547293220 946149565 3 1 547293220 946149565 6 7 946149565 5 8 547293220 946149565 7 5 547293220 946149565 6 8 547293220 9461495...
result:
points 1.0 points 1.0 Correct
Test #3:
score: 0
Accepted
time: 6ms
memory: 3740kb
input:
100 5000 1 0 1 1 1 0 1 1 1 1 1 1 1 0 1 0 1 1 1 0 1 0 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 0 1 0 1 1 1 0 1 1 1 0 1 0 1 1 1 1 1 0 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 0 2 1 0 1 0 1 1 2 1 0 1 0 1 0 2 1 1 1 1 1 0 2 0 0 1 1 1 0 2 1 0 1 0 1 0 2 1 1 1 0 1 1 2 1 0 1...
output:
946149565 1 2 547293220 946149565 3 4 547293220 946149565 5 6 547293220 946149565 7 8 547293220 946149565 9 10 547293220 946149565 11 12 547293220 946149565 13 14 547293220 946149565 15 16 547293220 946149565 17 18 547293220 946149565 19 20 547293220 946149565 21 22 547293220 946149565 23 24 5472932...
result:
points 1.0 points 1.0 Correct
Test #4:
score: 0
Accepted
time: 22ms
memory: 3752kb
input:
250 5000 1 0 1 0 1 0 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 0 1 0 1 1 1 0 1 1 1 0 1 0 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 0 1 0 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 0 1 0 1 0 1 1 1 0 1 1 1 1 1 0 1 0 1 0 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 0 1 0 1 1 1 1 1 1 1 0 1 0 1 1 1 0 1 1 1 0 1 0 1 1 1 0 1 1 1 0...
output:
946149565 1 2 547293220 946149565 3 4 547293220 946149565 5 6 547293220 946149565 7 8 547293220 946149565 9 10 547293220 946149565 11 12 547293220 946149565 13 14 547293220 946149565 15 16 547293220 946149565 17 18 547293220 946149565 19 20 547293220 946149565 21 22 547293220 946149565 23 24 5472932...
result:
points 1.0 points 1.0 Correct
Test #5:
score: 0
Accepted
time: 49ms
memory: 3732kb
input:
500 5000 1 0 1 0 1 0 1 1 1 0 1 0 1 1 1 0 1 0 1 1 1 0 1 1 1 0 1 0 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 1 1 1 0 1 1 1 0 1 0 1 0 1 0 1 1 1 0 1 0 1 1 1 0 1 1 1 0 1 0 1 1 1 0 1 1 1 0 1 0 1 1 1 0 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 0 1 1 1 0 1 0 1 1 1 1 1 0 1 0 1 1...
output:
946149565 1 2 547293220 946149565 3 4 547293220 946149565 5 6 547293220 946149565 7 8 547293220 946149565 9 10 547293220 946149565 11 12 547293220 946149565 13 14 547293220 946149565 15 16 547293220 946149565 17 18 547293220 946149565 19 20 547293220 946149565 21 22 547293220 946149565 23 24 5472932...
result:
points 1.0 points 1.0 Correct
Test #6:
score: 0
Accepted
time: 47ms
memory: 3824kb
input:
500 5000 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 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...
output:
946149565 1 2 547293220 946149565 3 4 547293220 946149565 5 6 547293220 946149565 7 8 547293220 946149565 9 10 547293220 946149565 11 12 547293220 946149565 13 14 547293220 946149565 15 16 547293220 946149565 17 18 547293220 946149565 19 20 547293220 946149565 21 22 547293220 946149565 23 24 5472932...
result:
points 1.0 points 1.0 Correct
Test #7:
score: 0
Accepted
time: 41ms
memory: 3692kb
input:
500 5000 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0...
output:
946149565 1 2 547293220 946149565 3 4 547293220 946149565 5 6 547293220 946149565 7 8 547293220 946149565 9 10 547293220 946149565 11 12 547293220 946149565 13 14 547293220 946149565 15 16 547293220 946149565 17 18 547293220 946149565 19 20 547293220 946149565 21 22 547293220 946149565 23 24 5472932...
result:
points 1.0 points 1.0 Correct
Test #8:
score: 0
Accepted
time: 55ms
memory: 3704kb
input:
500 5000 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0...
output:
946149565 1 2 547293220 946149565 3 4 547293220 946149565 5 6 547293220 946149565 7 8 547293220 946149565 9 10 547293220 946149565 11 12 547293220 946149565 13 14 547293220 946149565 15 16 547293220 946149565 17 18 547293220 946149565 19 20 547293220 946149565 21 22 547293220 946149565 23 24 5472932...
result:
points 1.0 points 1.0 Correct
Test #9:
score: 0
Accepted
time: 64ms
memory: 3732kb
input:
500 5000 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 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...
output:
946149565 1 2 547293220 946149565 3 4 547293220 946149565 5 6 547293220 946149565 7 8 547293220 946149565 9 10 547293220 946149565 11 12 547293220 946149565 13 14 547293220 946149565 15 16 547293220 946149565 17 18 547293220 946149565 19 20 547293220 946149565 21 22 547293220 946149565 23 24 5472932...
result:
points 1.0 points 1.0 Correct
Subtask #3:
score: 0
Runtime Error
Test #10:
score: 0
Runtime Error
input:
500 1000 1 0 1 0 1 0 1 1 1 0 1 0 1 1 1 0 1 0 1 1 1 0 1 1 1 0 1 0 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 1 1 1 0 1 1 1 0 1 0 1 0 1 0 1 1 1 0 1 0 1 1 1 0 1 1 1 0 1 0 1 1 1 0 1 1 1 0 1 0 1 1 1 0 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 0 1 1 1 0 1 0 1 1 1 1 1 0 1 0 1 1...
output:
946149565 1 2 547293220 946149565 3 4 547293220 946149565 5 6 547293220 946149565 7 8 547293220 946149565 9 10 547293220 946149565 11 12 547293220 946149565 13 14 547293220 946149565 15 16 547293220 946149565 17 18 547293220 946149565 19 20 547293220 946149565 21 22 547293220 946149565 23 24 5472932...
result:
Subtask #4:
score: 3
Accepted
Test #15:
score: 3
Accepted
time: 1ms
memory: 3784kb
input:
10 5000 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 4 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 4 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1
output:
946149565 1 2 547293220 946149565 3 4 547293220 946149565 5 6 547293220 946149565 7 8 547293220 946149565 9 10 547293220 946149565 1 4 946149565 2 3 547293220 946149565 1 2 547293220 946149565 4 3 547293220 946149565 5 8 946149565 6 7 547293220 946149565 8 7 547293220 946149565 5 6 547293220 9461495...
result:
points 1.0 points 1.0 Correct
Test #16:
score: 0
Accepted
time: 21ms
memory: 3716kb
input:
100 5000 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 2 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1...
output:
946149565 1 2 547293220 946149565 3 4 547293220 946149565 5 6 547293220 946149565 7 8 547293220 946149565 9 10 547293220 946149565 11 12 547293220 946149565 13 14 547293220 946149565 15 16 547293220 946149565 17 18 547293220 946149565 19 20 547293220 946149565 21 22 547293220 946149565 23 24 5472932...
result:
points 1.0 points 1.0 Correct
Subtask #5:
score: 2
Accepted
Dependency #4:
100%
Accepted
Test #17:
score: 2
Accepted
time: 5ms
memory: 3824kb
input:
10 5000 1 1 1 0 1 1 1 0 1 0 2 0 1 1 1 1 0 2 1 0 1 0 1 1 1 1 4 1 0 0 1 2 1 0 2 0 1 1 0 1 0 1 0 1 0 1 1 2 0 1 4 0 1 1 1 2 0 1 2 0 0 1 0 1 1 1 0 1 1 1 0
output:
946149565 1 2 547293220 946149565 3 4 547293220 946149565 5 6 547293220 946149565 7 8 547293220 946149565 9 10 547293220 946149565 1 3 946149565 2 4 547293220 946149565 3 2 547293220 946149565 1 4 547293220 946149565 5 7 946149565 6 8 547293220 946149565 7 6 547293220 946149565 5 8 547293220 9461495...
result:
points 1.0 points 1.0 Correct
Test #18:
score: 0
Accepted
time: 12ms
memory: 3684kb
input:
100 5000 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 0 1 0 1 1 1 0 1 0 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1 1 2 0 1 1 0 1 1 2 1 1 1 1 1 1 2 1 0 1 1 1 1 2 0 0 1 1 1 1 2 0 1 1 1 1 1 2 1 0 1 1 1 0 2 1 1 1...
output:
946149565 1 2 547293220 946149565 3 4 547293220 946149565 5 6 547293220 946149565 7 8 547293220 946149565 9 10 547293220 946149565 11 12 547293220 946149565 13 14 547293220 946149565 15 16 547293220 946149565 17 18 547293220 946149565 19 20 547293220 946149565 21 22 547293220 946149565 23 24 5472932...
result:
points 1.0 points 1.0 Correct
Subtask #6:
score: 9
Accepted
Dependency #4:
100%
Accepted
Test #19:
score: 9
Accepted
time: 20ms
memory: 3684kb
input:
250 5000 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 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...
output:
946149565 1 2 547293220 946149565 3 4 547293220 946149565 5 6 547293220 946149565 7 8 547293220 946149565 9 10 547293220 946149565 11 12 547293220 946149565 13 14 547293220 946149565 15 16 547293220 946149565 17 18 547293220 946149565 19 20 547293220 946149565 21 22 547293220 946149565 23 24 5472932...
result:
points 1.0 points 1.0 Correct
Test #20:
score: 0
Accepted
time: 38ms
memory: 3840kb
input:
500 5000 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 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...
output:
946149565 1 2 547293220 946149565 3 4 547293220 946149565 5 6 547293220 946149565 7 8 547293220 946149565 9 10 547293220 946149565 11 12 547293220 946149565 13 14 547293220 946149565 15 16 547293220 946149565 17 18 547293220 946149565 19 20 547293220 946149565 21 22 547293220 946149565 23 24 5472932...
result:
points 1.0 points 1.0 Correct
Subtask #7:
score: 6
Accepted
Dependency #2:
100%
Accepted
Dependency #5:
100%
Accepted
Dependency #6:
100%
Accepted
Test #21:
score: 6
Accepted
time: 19ms
memory: 3692kb
input:
250 5000 1 0 1 0 1 0 1 1 1 1 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1 1 1 0 1 0 1 0 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 0 1 0 1 0 1 0...
output:
946149565 1 2 547293220 946149565 3 4 547293220 946149565 5 6 547293220 946149565 7 8 547293220 946149565 9 10 547293220 946149565 11 12 547293220 946149565 13 14 547293220 946149565 15 16 547293220 946149565 17 18 547293220 946149565 19 20 547293220 946149565 21 22 547293220 946149565 23 24 5472932...
result:
points 1.0 points 1.0 Correct
Test #22:
score: 0
Accepted
time: 41ms
memory: 3700kb
input:
500 5000 1 0 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 0 1 0 1 0 1 1 1 0 1 1 1 1 1 0 1 0 1 1 1 0 1 0 1 0 1 1 1 1 1 0 1 1 1 0 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 0 1 0 1 1 1 0 1 1 1 0 1 0 1 1 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1...
output:
946149565 1 2 547293220 946149565 3 4 547293220 946149565 5 6 547293220 946149565 7 8 547293220 946149565 9 10 547293220 946149565 11 12 547293220 946149565 13 14 547293220 946149565 15 16 547293220 946149565 17 18 547293220 946149565 19 20 547293220 946149565 21 22 547293220 946149565 23 24 5472932...
result:
points 1.0 points 1.0 Correct
Subtask #8:
score: 0
Wrong Answer
Dependency #4:
100%
Accepted
Dependency #6:
100%
Accepted
Test #23:
score: 0
Wrong Answer
time: 30ms
memory: 3788kb
input:
500 500 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 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 ...
output:
946149565 1 2 547293220 946149565 3 4 547293220 946149565 5 6 547293220 946149565 7 8 547293220 946149565 9 10 547293220 946149565 11 12 547293220 946149565 13 14 547293220 946149565 15 16 547293220 946149565 17 18 547293220 946149565 19 20 547293220 946149565 21 22 547293220 946149565 23 24 5472932...
result:
points 0.0 points 0.0 Not correct
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:
100%
Accepted
Dependency #3:
0%