# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
210521 |
2020-03-17T15:01:22 Z |
bensonlzl |
ICC (CEOI16_icc) |
C++14 |
|
0 ms |
0 KB |
#include "icc.h"
#include <bits/stdc++.h>
using namespace std;
int s0, s1, a[105], b[105];
int par[105], sz[105];
int cnt[8], setbit;
void res(){
for (int i = 0; i < 105; ++i){
a[i] = b[i] = 0;
}
s0 = s1 = 0;
}
int solve(vector<int> A, vector<int> B){
if (B.size() == 1) return B[0];
vector<int> b0, b1;
for (int i = 0; i < B.size(); ++i){
if (i%2 == 0) b0.push_back(B[i]);
else b1.push_back(B[i]);
}
res();
for (int i = 0; i < A.size(); ++i){
a[i] = A[i];
}
for (int i = 0; i < b0.size(); ++i){
b[i] = b0[i];
}
int q = query(A.size(),b0.size(),a,b);
if (q) return solve(A,b0);
else return solve(A,b1);
}
void run(int n) {
for (int i = 1; i < n; ++i){
for (int j = 0; j < 7; ++j){
res();
for (int v = 1; v <= n; ++v){
if (v & (1 << j)){
b[s1] = v;
s1++;
}
else{
a[s0] = v;
s0++;
}
}
cnt[j] = query(s0,s1,a,b);
}
for (int k = 0; k < 7; ++k){
if (cnt[k] == 1){
setbit = k;
}
}
vector<int> v0, v1;
for (int v = 1; v <= n; ++v){
if (v & (1 << setbit)){
v1.push_back(v)
}
else{
v0.push_back(v);
}
}
int x = solve(v1,v2);
}
}
Compilation message
icc.cpp: In function 'int solve(std::vector<int>, std::vector<int>)':
icc.cpp:20:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < B.size(); ++i){
~~^~~~~~~~~~
icc.cpp:25:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < A.size(); ++i){
~~^~~~~~~~~~
icc.cpp:28:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < b0.size(); ++i){
~~^~~~~~~~~~~
icc.cpp: In function 'void run(int)':
icc.cpp:61:4: error: expected ';' before '}' token
}
^
icc.cpp:66:20: error: 'v2' was not declared in this scope
int x = solve(v1,v2);
^~
icc.cpp:66:20: note: suggested alternative: 'v1'
int x = solve(v1,v2);
^~
v1
icc.cpp:66:7: warning: unused variable 'x' [-Wunused-variable]
int x = solve(v1,v2);
^