제출 #231060

#제출 시각아이디문제언어결과실행 시간메모리
231060nicolaalexandraICC (CEOI16_icc)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> //#include "icc.h" #define DIM 200 using namespace std; vector <int> L[DIM],comp[DIM],w; int n,i,x,y,k,k2,el; int v[DIM],t[DIM],aux[DIM],a[DIM],b[DIM]; /*int query (int n, int m, int a[], int b[]){ int ans; cout<<n<<" "; for (int i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl; cout<<m<<" "; for (int i=0;i<m;i++) cout<<b[i]<<" "; cout<<endl; cin>>ans; return ans; } void setRoad (int x, int y){ cout<<x<<" "<<y<<endl; } */ int get_rad (int x){ while (t[x] > 0) x = t[x]; return x; } void _union (int x, int y){ int radx = get_rad (x), rady = get_rad (y); if (t[radx] < t[rady]){ t[radx] += t[rady]; t[rady] = radx; } else { t[rady] += t[radx]; t[radx] = rady; } } void solve2 (int n, int m, int a[], int b[]){ int st = 0, dr = n-1; while (st <= dr){ int mid = (st+dr)>>1; el = 0; aux[el++] = a[mid]; if (query(el,m,aux,b)){ x = a[mid]; break; } el = 0; for (int i=st;i<=mid;i++) aux[el++] = a[i]; if (query(el,m,aux,b)) /// clar se afla in stanga dr = mid-1; else st = mid+1; } st = 0, dr = m-1; while (st <= dr){ int mid = (st+dr)>>1; el = 0; aux[el++] = b[mid]; if (query(n,el,a,aux)){ y = b[mid]; break; } el = 0; for (int i=st;i<=mid;i++) aux[el++] = b[i]; if (query(n,el,a,aux)) dr = mid-1; else st = mid+1; } } void solve (){ /// impart componentele conexe in doua multimi for (int bit=0;bit<8;bit++){ k = 0, k2 = 0; for (int i=1;i<=n;i++){ int val = get_rad(i); if (val&(1<<bit)) a[k++] = i; else b[k2++] = i; } if (!k || !k2) continue; if (query(k,k2,a,b)){ /// am gasit cele doua multimi solve2 (k,k2,a,b); break; } } _union (x,y); } void run (int n){ memset (t,-1,sizeof t); for (int i=1;i<n;i++){ solve(); setRoad(x,y); } }

컴파일 시 표준 에러 (stderr) 메시지

icc.cpp: In function 'void solve2(int, int, int*, int*)':
icc.cpp:54:13: error: 'query' was not declared in this scope
         if (query(el,m,aux,b)){
             ^~~~~
icc.cpp:63:13: error: 'query' was not declared in this scope
         if (query(el,m,aux,b)) /// clar se afla in stanga
             ^~~~~
icc.cpp:74:13: error: 'query' was not declared in this scope
         if (query(n,el,a,aux)){
             ^~~~~
icc.cpp:82:13: error: 'query' was not declared in this scope
         if (query(n,el,a,aux))
             ^~~~~
icc.cpp: In function 'void solve()':
icc.cpp:105:13: error: 'query' was not declared in this scope
         if (query(k,k2,a,b)){ /// am gasit cele doua multimi
             ^~~~~
icc.cpp: In function 'void run(int)':
icc.cpp:120:9: error: 'setRoad' was not declared in this scope
         setRoad(x,y);
         ^~~~~~~
icc.cpp:120:9: note: suggested alternative: 'get_rad'
         setRoad(x,y);
         ^~~~~~~
         get_rad