QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#875556 | #2745. Mechanical Doll | Alimkhan | 28 | 159ms | 34388kb | C++23 | 1.6kb | 2025-01-29 23:09:12 | 2025-01-29 23:09:14 |
Judging History
answer
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ff first
#define ss second
const int maxn = 1e6 + 10;
int n, s, pw, l, id, a[maxn];
vector <int> X, Y;
vector <int> c;
map <int, int> lf, rg;
vector <pair <int, int> > d;
void get(int v, int tl, int tr) {
int tm = (tl + tr) / 2;
if (tm <= l) {
lf[v] = -1;
}
if (tm + 1 == tr) {
rg[v] = a[tr];
// cnt++;
} else {
s--;
rg[v] = s;
get(s, tm + 1, tr);
}
if (tl == tm && lf[v] == 0) {
lf[v] = a[tl];
// cnt++;
} else {
if (lf[v] == 0) {
s--;
lf[v] = s;
get(s, tl, tm);
}
}
// cout << v << " " << lf[v] << " " << rg[v] << '\n';
}
void create_circuit(int M, std::vector<int> A) {
A.push_back(0);
c = {A[0]};
A.erase(A.begin());
// a = A;
n = A.size();
pw = 2;
while(pw < n) {
pw *= 2;
}
while(l + n < pw) {
l++;
a[l] = -1;
}
for (int i = 0; i < A.size(); i++) {
int x = 0;
for (int j = 19; j >= 0; j--) {
if ((((i + l) >> j) & 1) == 1) {
x += (1 << (19 - j));
}
}
d.push_back({x, A[i]});
}
sort(d.begin(), d.end());
id = l + 1;
for (int i = 0; i < d.size(); i++) {
a[id] = d[i].ss;
id++;
}
s = -1;
get(-1, 1, pw);
for (int i = 1; i <= M; i++) {
c.push_back(-1);
}
//c.push_back(-1);
for (int i = -1; i >= s; i--) {
X.push_back(lf[i]);
Y.push_back(rg[i]);
// cout << i << " " << lf[i] << " " << rg[i] << '\n';
}
// for (int i = 0; i < c.size(); i++) {
// cout << c[i] << " ";
// }
// cout << '\n';
answer(c, X, Y);
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3840kb
input:
9 9 2 9 8 1 3 7 6 4 5
output:
Wrong Answer: wrong motion
result:
wrong answer
Subtask #2:
score: 0
Wrong Answer
Test #8:
score: 4
Accepted
time: 98ms
memory: 22496kb
input:
65537 131072 38169 29889 63383 43430 55643 44435 63973 61457 18223 38917 62266 26543 10814 970 44978 20275 62383 23625 55275 37609 18805 62029 32115 42887 25636 51086 64204 11787 41137 16164 3764 59071 41518 13112 48670 57859 63154 43506 4175 38360 56815 16082 35241 41583 11729 45167 16539 36608 524...
output:
Accepted: 131071 2228224
result:
points 1
Test #9:
score: 0
Wrong Answer
time: 75ms
memory: 25744kb
input:
100000 131073 61734 73042 59366 33009 62560 73038 44339 86523 7658 34359 76827 68571 83863 26715 88078 65508 68589 49267 62747 51316 8508 22067 59629 33963 92558 84309 55385 62694 77667 76171 19976 83841 19035 4944 24964 37987 53770 8114 2322 56094 74735 17468 73405 5746 83339 10532 76504 26243 1501...
output:
Wrong Answer: wrong motion
result:
wrong answer
Subtask #3:
score: 0
Wrong Answer
Test #14:
score: 0
Wrong Answer
time: 123ms
memory: 32816kb
input:
66666 199998 46730 34215 30702 41294 43268 29126 13518 38942 42908 58361 10352 13453 61990 51635 45179 17080 11893 59293 8765 48892 9847 29159 4183 35752 44930 54866 19016 8489 9471 61999 29220 3802 39755 15070 38640 20910 16621 20205 2930 36405 53436 33759 40537 24283 20254 60792 29716 4450 42478 2...
output:
Wrong Answer: wrong motion
result:
wrong answer
Subtask #4:
score: 10
Accepted
Test #23:
score: 10
Accepted
time: 0ms
memory: 3840kb
input:
5 16 2 4 2 4 5 5 2 4 5 4 2 2 5 5 4 1
output:
Accepted: 15 64
result:
points 1
Test #24:
score: 10
Accepted
time: 0ms
memory: 3840kb
input:
3 16 2 3 3 2 2 1 2 1 2 2 1 1 3 3 3 1
output:
Accepted: 15 64
result:
points 1
Test #25:
score: 10
Accepted
time: 0ms
memory: 3840kb
input:
3 16 3 3 3 3 1 1 3 3 3 2 3 3 2 1 1 1
output:
Accepted: 15 64
result:
points 1
Test #26:
score: 10
Accepted
time: 1ms
memory: 3840kb
input:
2 16 1 2 2 1 2 1 2 2 1 2 2 1 2 1 1 2
output:
Accepted: 15 64
result:
points 1
Test #27:
score: 10
Accepted
time: 0ms
memory: 3840kb
input:
2 16 1 1 2 2 1 2 2 2 2 1 2 2 2 2 2 1
output:
Accepted: 15 64
result:
points 1
Test #28:
score: 10
Accepted
time: 0ms
memory: 3968kb
input:
1 16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
output:
Accepted: 15 64
result:
points 1
Test #29:
score: 10
Accepted
time: 0ms
memory: 3840kb
input:
4 16 2 3 1 2 2 4 1 1 3 3 1 3 3 4 1 4
output:
Accepted: 15 64
result:
points 1
Test #30:
score: 10
Accepted
time: 0ms
memory: 3968kb
input:
4 16 4 2 3 2 2 2 2 1 3 1 2 3 4 2 1 3
output:
Accepted: 15 64
result:
points 1
Subtask #5:
score: 18
Accepted
Test #31:
score: 18
Accepted
time: 0ms
memory: 3840kb
input:
1 33 1 1 1 1 1 1 1 1 1 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:
Accepted: 37 286
result:
points 1
Test #32:
score: 18
Accepted
time: 96ms
memory: 21724kb
input:
1 131072 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
Accepted: 131071 2228224
result:
points 1
Test #33:
score: 18
Accepted
time: 94ms
memory: 24552kb
input:
1 131073 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
Accepted: 131089 2752510
result:
points 1
Test #34:
score: 18
Accepted
time: 159ms
memory: 33428kb
input:
1 200000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
Accepted: 200006 3836160
result:
points 1
Subtask #6:
score: 0
Wrong Answer
Test #35:
score: 0
Wrong Answer
time: 129ms
memory: 34388kb
input:
40000 200000 18605 24497 29838 20963 4861 7592 1633 39477 36565 8297 18190 30474 13552 13537 21338 11904 20265 31867 16132 3720 10773 14695 7860 2766 29 34536 36990 22269 35364 15921 24814 6064 39832 24011 17689 20704 9159 7612 1993 36334 29110 2976 29779 10914 25954 17922 39388 28558 30311 7769 195...
output:
Wrong Answer: wrong motion
result:
wrong answer