Submission #752749

# Submission time Handle Problem Language Result Execution time Memory
752749 2023-06-03T15:38:36 Z the_programmer_of_python Carnival (CEOI14_carnival) C++11
0 / 100
1 ms 208 KB
#include <bits/stdc++.h>

using namespace std;

#define _us using
#define _tp template
#define _tn typename
#define _ot cout <<
#define _er cerr <<
#define _in cin >>
#define _p << ' ' <<
#define _nl '\n'
#define _el << _nl
#define _rg(i, s, e) for (auto i = s; i < e; ++i)
#define _up(i, e) _rg(i, 0, e)
#define _ce constexpr
#define _cs const
#define _st static
#define _il inline
_us ll = long long;
_tp<_tn _t> _us vec = vector<_t>;
_tp<_tn _t> _us dbl = pair<_t, _t>;
_us sz = size_t;
_us u32 = uint32_t;
#define _mp make_pair
#define _mt make_tuple
#define _f first
#define _s second

/*\
 * States:
 *  - Unknown(n) // Can be any one of <n> states
 *  - Maybe({i}) // Can be any state in <{i}>
 *  - Is(i)      // Is state i
\*/

enum StateKind { skUnknown, skMaybe, skIs };
struct State {
	StateKind kind;
	int unknown;
	vec<int> maybe;
	int is;
};

int n, c;
int tmpc;
State states[150];
int repr[151];

int main() {
#undef _el
#define _el << endl
	iostream::sync_with_stdio(false);
	cin.tie(0);

	memset(repr, 255, sizeof(repr));

	_in n;
	_ot n; _up(i, n) { _ot "" _p i; } _ot endl;
	_in c;
	_up(i, n) states[i] = State{.kind = skUnknown, .unknown = c};
	states[0] = State{.kind = skIs, .is = 1};
	repr[1] = 0;
	_ot 2 _p 1 _p 2 _el;
	_in tmpc;
	if (tmpc == 1) {
		states[1] = State{.kind = skIs, .is = 1};
	} else {
		states[1] = State{.kind = skIs, .is = 2};
		repr[2] = 1;
	}
	_rg(i, 2, n) {
		_rg(j, 1, c+1) {
			if (repr[j] == -1) {
				repr[j] = i;
				states[i] = State{.kind = skIs, .is = j};
				break;
			}
			_ot 2 _p (repr[j]+1) _p (i+1) _el;
			_in tmpc;
			if (tmpc == 1) {
				states[i] = State{.kind = skIs, .is = j};
				break;
			}
		}
	}
	//_up(i, n) _er "" _p states[i].kind; _er endl;
	_ot 0; _up(i, n) { _ot "" _p states[i].is; } _ot endl;
}
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -