QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#875230 | #8592. Toxic Gene 2 | arnur2937 | 0 | 2ms | 3840kb | C++14 | 3.1kb | 2025-01-29 13:31:11 | 2025-01-29 13:31:12 |
Judging History
answer
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math,inline")
#include "toxic.h"
#include <bits/stdc++.h>
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,lzcnt,mmx,abm,avx,avx2,fma")
using namespace std;
#define static_assert(...);
#define speed ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define bigInt __int128
#define dl double long
#define fl float
#define all(s) s.begin(), s.end()
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pob_front
#define ins insert
#define F first
#define S second
#define len length
void determine_type(int n) {
vector<int> v;
int m = (n + 1) / 2;
for (int i = 0; i < m; ++i) {
v.pub(0);
}
for (int i = 1; i < m; ++i) {
v.pub(i);
}
// for (int x: v) {
// cout << x << ' ';
// }
// cout << '\n';
vector<int> ret = query_machine(v);
// for (int x: ret) {
// cout << x << ' ';
// }
// cout << '\n';
int toxic;
if (ret.back() == v.size()) {
v.clear();
for (int i = 0; i < m; ++i) {
v.pub(0);
}
for (int i = m; i < m * 2 - 1; ++i) {
v.pub(i);
}
// cout << "!! ";
// for (int x: v) {
// cout << x << ' ';
// }
// cout << '\n';
ret = query_machine(v);
// for (int x: ret) {
// cout << x << ' ';
// }
// cout << '\n';
if (ret.back() < v.size()) {
toxic = (int)ret.size();
}
else {
//cerr << "IN\n";
v.clear();
v.pub(0);
v.pub(0);
v.pub(n - 1);
ret = query_machine(v);
if (ret.back() == 1) {
toxic = n - 1;
}
else {
toxic = 0;
}
}
}
else if (ret.back() >= m) {
//cerr << "IN1\n";
toxic = 0;
}
else {
toxic = (int)ret.size() - m + 1;
}
//cerr << "! " << toxic << '\n';
v.clear();
int len = 1;
vector<char> ans(n, 'T');
vector<int> a;
for (int i = 0; i <= n; ++i) {
if (i == toxic) continue;
int k = (int)a.size();
if ((k + 2) * (k + 2) > 2000 || i == n) {
v.clear();
v.pub(toxic);
for (int j = 0; j < k; ++j) {
for (int l = 0; l < j + 1; ++l) {
v.pub(a[j]);
}
v.pub(toxic);
}
ret = query_machine(v);
// if (ret.size() <= a.size()) {
// cerr << "! ";
// for (int x: a) {
// cerr << x << ' ';
// }
// cerr << endl;
// for (int x: v) {
// cerr << x << ' ';
// }
// cerr << endl;
// for (int x: ret) {
// cerr << x << ' ';
// }
// cerr << endl;
// return;
// }
assert(ret.size() <= a.size());
for (int j = 0; j < ret.size(); j += 2) {
int last = (j > 0 ? ret[j] - ret[j - 1] : v.size());
if ((last - ret[j]) % 2) {
ans[a[j]] = 'R';
}
if (j + 1 < ret.size()) {
if (ret[j + 1] - ret[j] > 2) {
ans[a[j + 1]] = 'R';
}
}
}
a.clear();
}
a.pub(i);
}
// cout << "!! ";
// for (char x: ans) {
// cout << x << ' ';
// }
// cout << '\n';
answer_type(ans);
}
/*
НЕ ЗАХОДИТ РЕШЕНИЕ?
1) ПРОВЕРЬ НА ОЧЕВИДНЫЕ ОШИБКИ В КОДЕ
2) ПРОВЕРЬ НА ПЕРЕПОЛНЕНИЯ
3) УБЕДИСЬ В ПРАВИЛЬНОСТИ АЛГОРИТМА
*/
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3840kb
input:
2 1000 TTTRTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTRTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTRTTTTTTTTRTTTTTTTTTTTTTTTTTTTTRTTRTTTTTTTTTTTTRTTTTRTTTTTTTTTTTTTTTTTRTTTTRTTTTTTTTTTTTTTTTTTTTTTTTRTTTTTTTTTTTTTTTTTTTTTTT...
result:
wrong answer Incorrect value returned
Subtask #2:
score: 0
Wrong Answer
Test #30:
score: 0
Wrong Answer
time: 2ms
memory: 3840kb
input:
2 1000 RRTTRRRRRTTRTTRRTTTTTTTTTTTTTRTTRRRRTTRRTTRTRRTRTRTTTTTRTRTTTTTTRRTTTRTTRTTTTRTTRTTRTTRTTRTRRRTRTTTTTRRTTTTTTRRRTRRTRRRRRTTTTTTTTTRTTRTRRTTTRRRTRRRTRTRTTRTTTRTRTRTRTTTRRTTTTTTTRTRRTRTTRTTTTTRTTRTTTRRTRTRTTRTRTRTTTTRTTTTTRTTTTTRRRTRTRRTRRTTTTTRTTTRTRTTTRTRTRRTRTTTRRTRRTTTRTRTTRRTTRTTTRRTTTRRRR...
result:
wrong answer Incorrect value returned