# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
955582 | ono_de206 | Toxic Gene (NOI23_toxic) | C++17 | 6 ms | 704 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "toxic.h"
#include<bits/stdc++.h>
using namespace std;
#define in insert
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
//#define int long long
typedef long long ll;
typedef vector<int> vi;
typedef set<int> si;
typedef multiset<int> msi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
void determine_type(int n) {
vector<int> type(n + 1, -1);
auto dfs = [&](auto &self, int l, int r) {
vector<int> ask(r - l + 1);
iota(all(ask), l);
if(query_sample(ask) == r - l + 1) return;
if(l == r) type[l] = 1;
else {
int m = (l + r) / 2;
self(self, l, m);
self(self, m + 1, r);
}
};
dfs(dfs, 1, n);
vector<int> non;
int samp;
for(int i = 1; i <= n; i++) {
if(type[i] == -1) non.pb(i);
else samp = i;
}
for(int l = 0, r; l < non.size(); l = r) {
r = min((int)non.size(), l + 7);
vector<int> ask{samp};
for(int j = l; j < r; j++) {
int cnt = (1 << (j - l));
for(int _ = 0; _ < cnt; _++) {
ask.pb(non[j]);
}
}
int ans = query_sample(ask);
for(int j = l; j < r; j++) {
int cnt = (1 << (j - l));
if(ans & cnt) type[non[j]] = 0;
else type[non[j]] = 2;
}
}
string str = "STR";
for(int i = 1; i <= n; i++) {
answer_type(i, str[type[i]]);
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |