답안 #388896

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
388896 2021-04-13T09:10:18 Z mariowong CEOI16_icc (CEOI16_icc) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "icc.h"

using namespace std;
/* 
 
int a[105],b[105],pt[10],ans1,ans2,nowl,nowr,nowmid,c[105],d[105],x;
int query (int sz1,int sz2,int e[],int g[]){
	for (int i=0;i<sz1;i++){
		cout << e[i] << " ";
	}
	cout << "\n";
	for (int i=0;i<sz2;i++){
		cout << g[i] << " ";
	}
	cout << "\n";
	cin >> x;
	return x;
}
void setRoad(int a1,int a2){
	cout << "Road set: " << a1 << " " << a2 << "\n";
}*/
void solve(int l,int r){
	int mid=(l+r)/2;
	if (l == r);
	else
	{
		pt[0]=0; pt[1]=0;
		for (int i=l;i<=mid;i++){
			a[pt[0]]=i;
			pt[0]++;
		}
		for (int i=mid+1;i<=r;i++){
			b[pt[1]]=i;
			pt[1]++;
		}
		if (query(pt[0],pt[1],a,b) == 1){
			nowl=0; nowr=pt[0]-1;
			while (nowl < nowr){
				nowmid=(nowl+nowr)/2; pt[2]=0;
				for (int i=nowl;i<=nowmid;i++){
					c[pt[2]]=a[i];
					pt[2]++;
				}
				if (query(pt[2],pt[1],c,b) == 0)
				nowl=nowmid+1;
				else
				nowr=nowmid;				
			}
			ans1=a[nowl];
			
			nowl=0; nowr=pt[1]-1;
			while (nowl < nowr){
				nowmid=(nowl+nowr)/2; pt[3]=0;
				for (int i=nowl;i<=nowmid;i++){
					d[pt[3]]=b[i];
					pt[3]++;
				}
				c[0]=ans1;
				if (query(1,pt[3],c,d) == 0)
				nowl=nowmid+1;
				else
				nowr=nowmid;				
			}
			ans2=b[nowl];
		}
		else
		if (query(pt[1],pt[0],b,a) == 1){
			swap(a,b); swap(pt[0],pt[1]);
			nowl=0; nowr=pt[0]-1;
			while (nowl < nowr){
				nowmid=(nowl+nowr)/2; pt[2]=0;
				for (int i=nowl;i<=nowmid;i++){
					c[pt[2]]=a[i];
					pt[2]++;
				}
				if (query(pt[2],pt[1],c,b) == 0)
				nowl=nowmid+1;
				else
				nowr=nowmid;				
			}
			ans1=a[nowl];
			
			nowl=0; nowr=pt[1]-1;
			while (nowl < nowr){
				nowmid=(nowl+nowr)/2; pt[3]=0;
				for (int i=nowl;i<=nowmid;i++){
					d[pt[3]]=b[i];
					pt[3]++;
				}
				c[0]=ans1;
				if (query(1,pt[3],c,d) == 0)
				nowl=nowmid+1;
				else
				nowr=nowmid;				
			}
			ans2=b[nowl];
		}
		else
		{		
			if (ans1 == 0 && ans2 == 0)
			solve(l,mid);
			if (ans1 == 0 && ans2 == 0)
			solve(mid+1,r);
		}
	}
}

void run(int N){
	for (int i=1;i<N;i++){
		ans1=0; ans2=0;
		solve(1,N);
		setRoad(ans1,ans2);
	}
}
/*int main(){
	run(4);
}*/

Compilation message

icc.cpp: In function 'void solve(int, int)':
icc.cpp:28:3: error: 'pt' was not declared in this scope
   28 |   pt[0]=0; pt[1]=0;
      |   ^~
icc.cpp:30:4: error: 'a' was not declared in this scope
   30 |    a[pt[0]]=i;
      |    ^
icc.cpp:34:4: error: 'b' was not declared in this scope
   34 |    b[pt[1]]=i;
      |    ^
icc.cpp:37:25: error: 'a' was not declared in this scope
   37 |   if (query(pt[0],pt[1],a,b) == 1){
      |                         ^
icc.cpp:37:27: error: 'b' was not declared in this scope
   37 |   if (query(pt[0],pt[1],a,b) == 1){
      |                           ^
icc.cpp:38:4: error: 'nowl' was not declared in this scope; did you mean 'powl'?
   38 |    nowl=0; nowr=pt[0]-1;
      |    ^~~~
      |    powl
icc.cpp:38:12: error: 'nowr' was not declared in this scope
   38 |    nowl=0; nowr=pt[0]-1;
      |            ^~~~
icc.cpp:40:5: error: 'nowmid' was not declared in this scope
   40 |     nowmid=(nowl+nowr)/2; pt[2]=0;
      |     ^~~~~~
icc.cpp:42:6: error: 'c' was not declared in this scope
   42 |      c[pt[2]]=a[i];
      |      ^
icc.cpp:45:27: error: 'c' was not declared in this scope
   45 |     if (query(pt[2],pt[1],c,b) == 0)
      |                           ^
icc.cpp:50:4: error: 'ans1' was not declared in this scope
   50 |    ans1=a[nowl];
      |    ^~~~
icc.cpp:54:5: error: 'nowmid' was not declared in this scope
   54 |     nowmid=(nowl+nowr)/2; pt[3]=0;
      |     ^~~~~~
icc.cpp:56:6: error: 'd' was not declared in this scope
   56 |      d[pt[3]]=b[i];
      |      ^
icc.cpp:59:5: error: 'c' was not declared in this scope
   59 |     c[0]=ans1;
      |     ^
icc.cpp:60:25: error: 'd' was not declared in this scope
   60 |     if (query(1,pt[3],c,d) == 0)
      |                         ^
icc.cpp:65:4: error: 'ans2' was not declared in this scope
   65 |    ans2=b[nowl];
      |    ^~~~
icc.cpp:70:4: error: 'nowl' was not declared in this scope; did you mean 'powl'?
   70 |    nowl=0; nowr=pt[0]-1;
      |    ^~~~
      |    powl
icc.cpp:70:12: error: 'nowr' was not declared in this scope
   70 |    nowl=0; nowr=pt[0]-1;
      |            ^~~~
icc.cpp:72:5: error: 'nowmid' was not declared in this scope
   72 |     nowmid=(nowl+nowr)/2; pt[2]=0;
      |     ^~~~~~
icc.cpp:74:6: error: 'c' was not declared in this scope
   74 |      c[pt[2]]=a[i];
      |      ^
icc.cpp:77:27: error: 'c' was not declared in this scope
   77 |     if (query(pt[2],pt[1],c,b) == 0)
      |                           ^
icc.cpp:82:4: error: 'ans1' was not declared in this scope
   82 |    ans1=a[nowl];
      |    ^~~~
icc.cpp:86:5: error: 'nowmid' was not declared in this scope
   86 |     nowmid=(nowl+nowr)/2; pt[3]=0;
      |     ^~~~~~
icc.cpp:88:6: error: 'd' was not declared in this scope
   88 |      d[pt[3]]=b[i];
      |      ^
icc.cpp:91:5: error: 'c' was not declared in this scope
   91 |     c[0]=ans1;
      |     ^
icc.cpp:92:25: error: 'd' was not declared in this scope
   92 |     if (query(1,pt[3],c,d) == 0)
      |                         ^
icc.cpp:97:4: error: 'ans2' was not declared in this scope
   97 |    ans2=b[nowl];
      |    ^~~~
icc.cpp:101:8: error: 'ans1' was not declared in this scope
  101 |    if (ans1 == 0 && ans2 == 0)
      |        ^~~~
icc.cpp:101:21: error: 'ans2' was not declared in this scope
  101 |    if (ans1 == 0 && ans2 == 0)
      |                     ^~~~
icc.cpp:103:8: error: 'ans1' was not declared in this scope
  103 |    if (ans1 == 0 && ans2 == 0)
      |        ^~~~
icc.cpp:103:21: error: 'ans2' was not declared in this scope
  103 |    if (ans1 == 0 && ans2 == 0)
      |                     ^~~~
icc.cpp: In function 'void run(int)':
icc.cpp:111:3: error: 'ans1' was not declared in this scope
  111 |   ans1=0; ans2=0;
      |   ^~~~
icc.cpp:111:11: error: 'ans2' was not declared in this scope
  111 |   ans1=0; ans2=0;
      |           ^~~~