# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
597439 |
2022-07-16T03:35:34 Z |
1bin |
ICC (CEOI16_icc) |
C++14 |
|
0 ms |
0 KB |
#include <bits/stdc++.h>
#include <icc.h>
using namespace std;
typedef long long ll;
#define all(v) v.begin(), v.end()
const int NMAX = 105;
int par[NMAX], a[NMAX], b[NMAX], sza, szb;
int find(int x){ return par[x] == -1 ? x : par[x] = find(par[x]);}
vector<int> v[NMAX];
void run(int n){
memset(par, -1, sizeof(par));
for(int i = 1; i <= n; i++) v[i].emplace_back(i);
int sz = n;
for(int i = 0; i < n - 1; i++, sz--){
vector<int> arr;
for(int i = 1; i <= n; i++)
if(par[i] == -1) arr.emplace_back(i);
for(int bit = 0; 1 << bit < sz; bit++){
for(int j = 0; j < sz; j++){
if(j & (1 << bit)) {
for(auto& x : v[j]) a[sza++] = x;
}
else{
for(auto& x : v[j]) b[szb++] = x;
}
}
if(query(sza, szb, a, b)){
int l = 0, r = sza - 1, m, x, y;
while(l < r){
m = (l + r) >> 1;
if(query(m - l + 1, szb, a + l, b)) r = m;
else l = m + 1;
}
x = a[l];
l = 0; r = szb - 1;
while(l < r){
m = (l + r) >> 1;
if(query(sza, m - l + 1, a, b + l)) r = m;
else l = m + 1;
}
y = b[l];
setRoad(x, y);
x = find(x); y = find(y);
if(v[x].size() < v[y].size()) swap(x, y);
for(int & t : y) v[x].emplace_back(t);
par[y] = x;
break;
}
}
}
return;
}
int main(void){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
return 0;
}
Compilation message
icc.cpp: In function 'void run(int)':
icc.cpp:48:31: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
48 | for(int & t : y) v[x].emplace_back(t);
| ^
| std::begin
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
from icc.cpp:1:
/usr/include/c++/10/valarray:1224:5: note: 'std::begin' declared here
1224 | begin(const valarray<_Tp>& __va)
| ^~~~~
icc.cpp:48:31: error: 'end' was not declared in this scope; did you mean 'std::end'?
48 | for(int & t : y) v[x].emplace_back(t);
| ^
| std::end
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
from icc.cpp:1:
/usr/include/c++/10/valarray:1244:5: note: 'std::end' declared here
1244 | end(const valarray<_Tp>& __va)
| ^~~