제출 #1364854

#제출 시각아이디문제언어결과실행 시간메모리
1364854gvancak앵무새 (IOI11_parrots)C++20
컴파일 에러
0 ms0 KiB
#include "encoder.h"
#include "encoderlib.h"

void generate(int p){
	cnt=0;
	for (int i=0; i<=p; i++){
		for (int j=0; j<=p; j++){
			for (int k=0; k<=p; k++){
				for (int o=0;o<=p; o++){
					if (i+j+k+o<=p){
					 v[cnt].pb(i); v[cnt].pb(j); v[cnt].pb(k); v[cnt].pb(o); 	cnt++;
					}
				}
			}
		}
	}
}

void encode(int N, int M[])
{
	generate(7);
//	cout<<v[10].size()<<endl;
	ll n=N;
	ll pw[10];
	pw[0]=1;
	ll x=0;
	for (int i=1; i<=8; i++) pw[i]=2*pw[i-1];
	vector <ll> v2[n+5];
	for (int i=0; i<n; i++){
		x=0;
		for (int j=0; j<=5; j++){
			if ((i&((1<<j)))==0) continue;
			x+=pw[j+2];
		}
		for (int j=1; j<=7; j++) v2[i].pb(x);
	}
	ll st[10],ind,k,num[10];
	for (int i=0; i<n; i++){
//	cout<<M[i]<<endl;
//	cout<<v[M[i]].size()<<endl;
		st[0]=v[M[i]][0]; st[1]=st[0]+v[M[i]][1];
		st[2]=st[1]+v[M[i]][2]; st[3]=st[2]+v[M[i]][3];
		ind=0;
		k=0;	
	//	cout<<"STTT "<<st[0]<<st[1]<<st[2]<<st[3]<<endl;
		for (int j=0; j<7; j++){
		//	cout<<"before: "<<v2[i][j]<<endl;
			while (ind<=3 && j>=st[ind]) ind++;
			if (ind>3) {k++; continue; }
			v2[i][j]+=ind;
		//		cout<<"after: "<<v2[i][j]<<endl;
		}	
		while (k--) v2[i].pop_back();
	
	}	
	for (int i=0; i<n; i++){
		for (int j=0; j<v2[i].size(); j++){
		send(v2[i][j]);
	}
	}

}

#include "decoder.h"
#include "decoderlib.h"

void generate(int p){
	cnt=0;
	for (int i=0; i<=p; i++){
		for (int j=0; j<=p; j++){
			for (int k=0; k<=p; k++){
				for (int o=0;o<=p; o++){
					if (i+j+k+o<=p){
					 v[cnt].pb(i); v[cnt].pb(j); v[cnt].pb(k); v[cnt].pb(o); 	cnt++;
					}
				}
			}
		}
	}
}

void decode(int n, int l, int a[])
{
	generate(7);
	vector <ll> v1[N+1];
	ll x=0,y;
	for (int i=0; i<l; i++){
		x=0;
		for (int j=2; j<=7; j++){
			if ((a[i]&((1<<j)))==0) continue;
			x+=(1<<(j-2));
		}
		y=0; 
		if ((a[i]&2)==2) y+=2; if ((a[i]&1)==1) y+=1;
	//	cout<<x<<" "<<y<<endl;
		v1[x].pb(y); 
	}	
	for (int i=0; i<n; i++) sort(v1[i].begin(),v1[i].end());
	ll raod[10],vin;
	for (int me=0; me<n; me++){
		raod[0]=raod[1]=raod[2]=raod[3]=0;
		for (int shen=0; shen<v1[me].size(); shen++){
			raod[v1[me][shen]]++;
		}
		cnt=0;
	for (int i=0; i<=7; i++){
		for (int j=0; j<=7; j++){
			for (int k=0; k<=7; k++){
				for (int o=0;o<=7; o++){
					if (i+j+k+o>7) continue;
					
					if (i==raod[0] && j==raod[1] && k==raod[2] && o==raod[3]){
						vin=cnt; break;
					}cnt++;
				}
			}
		}
		
	}
//	cout<<vin<<endl;
	output(vin);
	}
	
	
	
	
	
	
}

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

# 1번째 컴파일 단계

encoder.cpp: In function 'void generate(int)':
encoder.cpp:5:9: error: 'cnt' was not declared in this scope; did you mean 'int'?
    5 |         cnt=0;
      |         ^~~
      |         int
encoder.cpp:11:42: error: 'v' was not declared in this scope
   11 |                                          v[cnt].pb(i); v[cnt].pb(j); v[cnt].pb(k); v[cnt].pb(o);        cnt++;
      |                                          ^
encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:23:9: error: 'll' was not declared in this scope
   23 |         ll n=N;
      |         ^~
encoder.cpp:24:11: error: expected ';' before 'pw'
   24 |         ll pw[10];
      |           ^~~
      |           ;
encoder.cpp:25:9: error: 'pw' was not declared in this scope
   25 |         pw[0]=1;
      |         ^~
encoder.cpp:26:11: error: expected ';' before 'x'
   26 |         ll x=0;
      |           ^~
      |           ;
encoder.cpp:28:9: error: 'vector' was not declared in this scope
   28 |         vector <ll> v2[n+5];
      |         ^~~~~~
encoder.cpp:28:21: error: 'v2' was not declared in this scope
   28 |         vector <ll> v2[n+5];
      |                     ^~
encoder.cpp:28:24: error: 'n' was not declared in this scope
   28 |         vector <ll> v2[n+5];
      |                        ^
encoder.cpp:30:17: error: 'x' was not declared in this scope
   30 |                 x=0;
      |                 ^
encoder.cpp:37:11: error: expected ';' before 'st'
   37 |         ll st[10],ind,k,num[10];
      |           ^~~
      |           ;
encoder.cpp:41:17: error: 'st' was not declared in this scope; did you mean 'std'?
   41 |                 st[0]=v[M[i]][0]; st[1]=st[0]+v[M[i]][1];
      |                 ^~
      |                 std
encoder.cpp:41:23: error: 'v' was not declared in this scope
   41 |                 st[0]=v[M[i]][0]; st[1]=st[0]+v[M[i]][1];
      |                       ^
encoder.cpp:43:17: error: 'ind' was not declared in this scope; did you mean 'int'?
   43 |                 ind=0;
      |                 ^~~
      |                 int
encoder.cpp:44:17: error: 'k' was not declared in this scope
   44 |                 k=0;
      |                 ^