QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#787492 | #1133. Monster Game | _8_8_ | 0 | 30ms | 7992kb | C++17 | 1.6kb | 2024-11-27 12:15:00 | 2024-11-27 12:15:02 |
Judging History
answer
#include "monster.h"
#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// mt19937 rng(532123);
int mem[1001][1001];
int qr(int x, int y) {
if(mem[x][y] != -1) return mem[x][y];
int k = Query(x, y);
mem[x][y] = k;
mem[y][x] = 1 - k;
return k;
}
vector<int> Solve(int N) {
memset(mem, -1, sizeof(mem));
vector<int> a(N), res(N);
iota(a.begin(), a.end(), 0);
shuffle(a.begin(), a.end(), rng);
sort(a.begin(), a.end(), [&](int x, int y){
return !qr(x, y);
});
int i = 0;
auto calc = [&](vector<int> x, int v) {
int ret = 0;
for(int i : x) if(i != v) {
if(qr(v, i)) {
ret++;
}
}
return ret;
};
while(i < N - 1) {
vector<int> x;
vector<pair<int, int>> y;
for(int j = i; j < min(N, i + 10); j++) {
x.push_back(a[j]);
}
for(int j : x) {
y.emplace_back(calc(x, j), j);
}
sort(y.begin(), y.end());
int val = y[0].second;
if(y[1].first == 1 && qr(y[1].second, y[0].second)) {
val = y[1].second;
}
if((int)y.size() > 2 && y[2].first == 1) {
val = a[i + 2];
}
for(int j = i; j < N; j++) {
if(a[j] == val) {
reverse(a.begin() + i, a.begin() + j + 1);
i = j + 1;
break;
}
}
}
for(int i = 0; i < N; i++) {
res[a[i]] = i;
}
return res;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 10
Accepted
time: 2ms
memory: 7756kb
input:
4 0 1 0 0 0 1
output:
Q 2 0 Q 3 2 Q 3 0 Q 1 2 Q 1 3 Q 1 0 F 4 2 1 0 3
result:
points 1.0 points 1.0
Test #2:
score: 0
Wrong Answer
time: 0ms
memory: 7716kb
input:
4 0 0 0 1 0 1
output:
Q 0 3 Q 1 0 Q 2 1 Q 2 0 Q 2 3 Q 1 3 F 4 2 3 0 1
result:
wrong answer Wrong Answer [3]
Subtask #2:
score: 0
Wrong Answer
Test #33:
score: 0
Wrong Answer
time: 4ms
memory: 7988kb
input:
995 1 1 1 1 1 0 1 0 0 1 1 0 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 1 1 0 0 0 1 1 0 0 0 0 0 0 1 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 1 0 0 1 1 0 0 1 0 1 1 1 1 1 0 1 0 0 1 0 0 0 0 0 1 1 1 1 0 0 0 1 1 0 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 ...
output:
Q 194 114 Q 194 766 Q 114 766 Q 776 114 Q 114 779 Q 671 114 Q 586 114 Q 114 903 Q 114 281 Q 114 209 Q 132 114 Q 114 238 Q 114 668 Q 821 114 Q 114 301 Q 114 807 Q 86 114 Q 114 842 Q 114 340 Q 114 626 Q 114 677 Q 114 80 Q 114 648 Q 236 114 Q 114 817 Q 595 114 Q 114 923 Q 937 114 Q 114 257 Q 114 919 Q ...
result:
wrong answer Wrong Answer [3]
Subtask #3:
score: 0
Wrong Answer
Test #45:
score: 59.25
Acceptable Answer
time: 11ms
memory: 7724kb
input:
998 0 1 0 1 0 0 1 0 1 0 0 0 1 1 1 0 1 1 0 0 0 1 0 0 1 1 1 1 1 1 0 0 1 1 0 0 0 1 1 0 0 1 1 1 1 0 1 0 0 1 0 0 0 1 0 1 1 1 0 0 1 1 1 1 1 1 0 0 0 1 1 1 0 1 0 0 0 1 0 1 1 0 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 1 0 1 1 1 0 0 0 1 1 1 1 0 0 1 1 0 1 1 1 0 0 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 ...
output:
Q 756 386 Q 386 308 Q 756 308 Q 574 308 Q 308 620 Q 308 497 Q 308 302 Q 666 308 Q 737 308 Q 308 32 Q 308 770 Q 308 926 Q 308 10 Q 942 308 Q 308 445 Q 191 308 Q 268 308 Q 308 385 Q 375 308 Q 997 308 Q 813 308 Q 250 308 Q 308 798 Q 308 875 Q 308 595 Q 738 308 Q 308 349 Q 8 308 Q 308 869 Q 602 308 Q 30...
result:
points 0.790 points 0.790
Test #46:
score: 0
Wrong Answer
time: 30ms
memory: 7992kb
input:
999 0 0 1 0 0 0 1 0 1 1 1 0 0 1 0 0 0 1 0 0 1 0 0 0 0 0 0 1 1 1 0 1 0 1 1 1 1 1 1 1 0 1 0 0 0 1 0 0 0 1 1 1 0 1 0 1 0 0 0 0 0 0 1 0 1 0 1 0 0 1 1 1 1 0 1 0 0 1 0 1 0 0 0 1 1 1 1 1 1 1 0 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 1 1 0 1 1 0 1 1 0 1 1 0 0 1 0 0 1 1 1 1 1 0 1 0 0 0 0 1 1 0 0 1 1 0 ...
output:
Q 725 104 Q 104 728 Q 794 104 Q 104 169 Q 104 492 Q 104 309 Q 104 2 Q 709 104 Q 232 104 Q 104 403 Q 191 104 Q 104 740 Q 104 344 Q 104 615 Q 373 104 Q 659 104 Q 103 104 Q 682 104 Q 104 612 Q 104 823 Q 104 73 Q 217 104 Q 61 104 Q 742 104 Q 574 104 Q 747 104 Q 760 104 Q 457 104 Q 104 251 Q 580 104 Q 10...
result:
wrong answer Wrong Answer [3]