#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[255];
int repr[255];
int main() {
#undef _el
#define _el << endl
memset(repr, 255, sizeof(repr));
_in n;
_ot n; _up(i, n) { _ot "" _p (i+1); } _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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
208 KB |
Output is correct |
2 |
Correct |
10 ms |
208 KB |
Output is correct |
3 |
Partially correct |
54 ms |
208 KB |
Partially correct |
4 |
Partially correct |
77 ms |
208 KB |
Partially correct |
5 |
Correct |
2 ms |
208 KB |
Output is correct |
6 |
Correct |
2 ms |
208 KB |
Output is correct |
7 |
Correct |
18 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
208 KB |
Output is correct |
2 |
Correct |
22 ms |
208 KB |
Output is correct |
3 |
Partially correct |
49 ms |
208 KB |
Partially correct |
4 |
Partially correct |
90 ms |
208 KB |
Partially correct |
5 |
Correct |
3 ms |
208 KB |
Output is correct |
6 |
Correct |
2 ms |
208 KB |
Output is correct |
7 |
Correct |
7 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
208 KB |
Output is correct |
2 |
Correct |
5 ms |
208 KB |
Output is correct |
3 |
Partially correct |
48 ms |
208 KB |
Partially correct |
4 |
Partially correct |
75 ms |
208 KB |
Partially correct |
5 |
Correct |
6 ms |
208 KB |
Output is correct |
6 |
Correct |
9 ms |
208 KB |
Output is correct |
7 |
Correct |
27 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
208 KB |
Output is correct |
2 |
Correct |
6 ms |
208 KB |
Output is correct |
3 |
Partially correct |
56 ms |
208 KB |
Partially correct |
4 |
Partially correct |
103 ms |
208 KB |
Partially correct |
5 |
Correct |
10 ms |
208 KB |
Output is correct |
6 |
Correct |
23 ms |
208 KB |
Output is correct |
7 |
Correct |
30 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
208 KB |
Output is correct |
2 |
Correct |
13 ms |
208 KB |
Output is correct |
3 |
Partially correct |
55 ms |
208 KB |
Partially correct |
4 |
Partially correct |
68 ms |
208 KB |
Partially correct |
5 |
Correct |
35 ms |
208 KB |
Output is correct |
6 |
Partially correct |
50 ms |
208 KB |
Partially correct |
7 |
Partially correct |
107 ms |
208 KB |
Partially correct |