이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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
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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |