#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));
ask.isnert(ask.end(), vector<int>(cnt, 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]]);
}
}
Compilation message
toxic.cpp: In function 'void determine_type(int)':
toxic.cpp:41:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
41 | for(int l = 0, r; l < non.size(); l = r) {
| ~~^~~~~~~~~~~~
toxic.cpp:46:8: error: 'class std::vector<int>' has no member named 'isnert'; did you mean 'insert'?
46 | ask.isnert(ask.end(), vector<int>(cnt, non[j]));
| ^~~~~~
| insert
toxic.cpp:56:2: error: expected ',' or ';' before 'for'
56 | for(int i = 1; i <= n; i++) {
| ^~~
toxic.cpp:56:17: error: 'i' was not declared in this scope
56 | for(int i = 1; i <= n; i++) {
| ^