제출 #785972

#제출 시각아이디문제언어결과실행 시간메모리
785972Cyber_Wolf앵무새 (IOI11_parrots)C++17
컴파일 에러
0 ms0 KiB
// Problem: P6 - Parrots
// Contest: DMOJ - IOI '11
// URL: https://dmoj.ca/problem/ioi11p6
// Memory Limit: 256 MB
// Time Limit: 1000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast")

using namespace std;
using namespace __gnu_pbds;

#define lg long long
#define ordered_set	tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

int g[160], id;

void encode(int N, int M[])
{
	int b = 0;
	for(int i = 0; i < N; i++)
	{
		for(int j = 0; j < 8; j++)
		{
			if(!((1ll << j)&M[i]))	continue;
			b++;
			lg x = (i << 3)+j;
			send(x);
			// g[id++] = x;
			// for(int k = 10; k >= 0; k--)
			// {
				// if((1ll << k)&x)	cout << 1;
				// else	cout << 0;
			// }
			// cout << '\n';
		}
		// cout << '\n';
	}
	if(!b)	
	{
		while(N--)
		{
			send(0);
			// g[id++] = 0;
		}
	}
}
// Problem: P6 - Parrots
// Contest: DMOJ - IOI '11
// URL: https://dmoj.ca/problem/ioi11p6
// Memory Limit: 256 MB
// Time Limit: 1000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast")

using namespace std;
using namespace __gnu_pbds;

#define lg long long
#define ordered_set	tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

bool cmp(int a, int b)
{
	return a < b;
}

void decode(int N, int L, int X[])
{
	sort(X, X+L);
	if(!X[L-1])
	{
		while(L--)
		{
			output(0);
			// cout << "0\n";
		}
		return;
	}
	int la = -1;
	for(int i = 0; i < L; )
	{
		int j = i;
		lg o = 0;
		if((X[i] >> 3)-la > 1)
		{
			int diff =(X[i] >> 3)-la-1;
			while(diff--)
			{
				output(0);
				// cout << "0\n";
			}
		}
		la = (X[i] >> 3);
		while(j < L)
		{
			if((X[j] >> 3) != (X[i] >> 3))
			{
				break;
			}
			o += (1 << (X[j]&7));
			j++;
		}
		i = j;
		// cout << o << '\n';
		output(o);
	}
}

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

encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:33:4: error: 'send' was not declared in this scope
   33 |    send(x);
      |    ^~~~
encoder.cpp:48:4: error: 'send' was not declared in this scope
   48 |    send(0);
      |    ^~~~

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:33:4: error: 'output' was not declared in this scope
   33 |    output(0);
      |    ^~~~~~
decoder.cpp:48:5: error: 'output' was not declared in this scope
   48 |     output(0);
      |     ^~~~~~
decoder.cpp:64:3: error: 'output' was not declared in this scope
   64 |   output(o);
      |   ^~~~~~