답안 #63248

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
63248 2018-08-01T06:59:57 Z 윤교준(#1834) Alternating Current (BOI18_alternating) C++11
74 / 100
218 ms 12488 KB
#include <bits/stdc++.h>
#define rf(x) (x)=0;while(*p<48)p++;while(47<*p)(x)=((x)<<3)+((x)<<1)+(*p++&15);
#define pb push_back
#define eb emplace_back
#define sz(V) ((int)(V).size())
#define befv(V) ((V)[(sz(V)-2)])
#define allv(V) ((V).begin()),((V).end())
#define sorv(V) sort(allv(V))
#define revv(V) reverse(allv(V))
#define univ(V) (V).erase(unique(allv(V)),(V).end())
#define clv(V) (V).clear()
#define upmin(a,b) (a)=min((a),(b))
#define upmax(a,b) (a)=max((a),(b))
#define INF (0x3f3f3f3f)
#define INFLL (0x3f3f3f3f3f3f3f3fll)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
void fuk() { puts("impossible"); exit(0); }

const bool debug = 0;
const int MAXN = 100005;
const int MAXM = 100005;

struct PFS {
	int d[MAXN*2], N;
	void init() { fill(d, d+MAXN*2, 0); }
	void add(int s, int e) { d[s]++; d[e+1]--; }
	bool cal() {
		for(int i = 1; i <= N*2; i++) d[i+1] += d[i];
		for(int i = 1; i <= N; i++)
			if(!(d[i] + d[i+N])) return false;
		return true;
	}
} preA, preB;

vector<int> T[MAXN*2];
vector<int> G[MAXM], CH;
bitset<MAXM> isChild;
int prt[MAXM];

int A[MAXM], B[MAXM];

int Ans[MAXM];
int N, M;

bool isValid() {
	preA.init(); preB.init();
	for(int i = 1; i <= M; i++)
		(Ans[i] ? preA : preB).add(A[i], B[i]);
	return preA.cal() && preB.cal();
}

void dfs(int i, int c) {
	prt[i] = c;
	for(int v : G[i]) if(!prt[v])
		dfs(v, c);
}

int main() {
	ios::sync_with_stdio(false);

	cin >> N >> M;
	if(1000 < M) {
		for(int i = 1; i <= M; i++) cin >> A[i] >> B[i];

		for(int i = 1; i <= M; i++) G[A[i]].eb(i);

		int a = 0, b = 0;
		for(int i = 1; i <= N; i++) {
			for(int e : G[i]) {
				if(min(a, b) + 1 < i) fuk();
				if(a < b) {
					upmax(a, B[e]);
					Ans[e] = 0;
				} else {
					upmax(b, B[e]);
					Ans[e] = 1;
				}
			}
		}
		if(a < N || b < N) fuk();
		for(int i = 1; i <= M; i++) printf("%d", Ans[i]);
		puts("");
		return 0;
	}
	preA.N = preB.N = N;
	for(int i = 1; i <= M; i++) {
		cin >> A[i] >> B[i];
		if(A[i] > B[i]) B[i] += N;
		if(B[i]-A[i] == N-1) { A[i] = 1; B[i] = N; }
		T[A[i]].eb(i);
		T[A[i]+N].eb(i);

		if(debug) printf("%d ; %d %d\n", i, A[i], B[i]);
	}

	{
		int ci = -1;
		for(int i = 1; i <= M; i++)
			if(1 == A[i] && B[i] == N)
				ci = i;
		if(0 < ci) {
			for(int i = 1; i <= M; i++) if(i != ci) {
				isChild[i] = true;
				G[ci].eb(i);
			}
		} else {
			for(int i = 1; i <= M; i++) for(int j = 1; j <= M; j++) {
				if((A[i] <= A[j] && B[j] <= B[i])
					|| (A[i]+N <= A[j] && B[j] <= B[i]+N)
					|| (A[i] <= A[j]+N && B[j]+N <= B[i])) {
					if(A[i] == A[j] && B[i] == B[j]) {
						if(i >= j) continue;
					}
					isChild[j] = true;
					G[i].eb(j);
				}
			}
			/*
			for(int i = 1, st = 0, et = 0, ei = -1; i <= N*2; i++) {
				for(int v : T[i]) {
					int e = i + (B[v]-A[v]);
					if(e <= et) uf(ei, v);
					else {
						if(st == i) uf(v, ei);
						st = i; et = e; ei = v;
					}
				}
			}
			*/
		}
	}
	for(int i = 1; i <= M; i++) if(!isChild[i]) CH.eb(i);
	for(int i : CH) dfs(i, i);
	sort(allv(CH), [&](int a, int b) { return A[a] < A[b]; });

	if(debug) {
		for(int v : CH) printf("%d ", v); puts("");
	}

/*
	for(int v : CH) preA.add(A[v], B[v]);
	if(!preA.cal()) fuk();
	preA.init();
*/

	if(sz(CH) & 1) {
		for(int i = 0, n = sz(CH); i < n; i++) {
			for(int j = 0; j < i; j++) Ans[CH[j]] = (i-j-1) & 1;
			for(int j = i; j < n; j++) Ans[CH[j]] = (j-i) & 1;
			for(int j = 1; j <= M; j++) if(isChild[j])
				Ans[j] = !Ans[prt[j]];
			if(isValid()) break;
		}
	} else {
		for(int i = 0, n = sz(CH); i < n; i++)
			Ans[CH[i]] = i & 1;
		for(int i = 1; i <= M; i++) if(isChild[i])
			Ans[i] = !Ans[prt[i]];
	}

	if(!isValid()) fuk();
	for(int i = 1; i <= M; i++) printf("%d", !!Ans[i]);
	puts("");
	return 0;
}

Compilation message

alternating.cpp: In function 'int main()':
alternating.cpp:141:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   for(int v : CH) printf("%d ", v); puts("");
   ^~~
alternating.cpp:141:37: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   for(int v : CH) printf("%d ", v); puts("");
                                     ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 8952 KB Output is correct
2 Correct 12 ms 9060 KB Output is correct
3 Correct 12 ms 9060 KB Output is correct
4 Correct 13 ms 9060 KB Output is correct
5 Correct 10 ms 9084 KB Output is correct
6 Correct 10 ms 9100 KB Output is correct
7 Correct 11 ms 9288 KB Output is correct
8 Correct 12 ms 9288 KB Output is correct
9 Correct 12 ms 9288 KB Output is correct
10 Correct 13 ms 9288 KB Output is correct
11 Correct 13 ms 9288 KB Output is correct
12 Correct 12 ms 9288 KB Output is correct
13 Correct 14 ms 9288 KB Output is correct
14 Correct 12 ms 9288 KB Output is correct
15 Correct 14 ms 9288 KB Output is correct
16 Correct 7 ms 9288 KB Output is correct
17 Correct 11 ms 9288 KB Output is correct
18 Correct 12 ms 9288 KB Output is correct
19 Correct 12 ms 9288 KB Output is correct
20 Correct 11 ms 9288 KB Output is correct
21 Correct 13 ms 9288 KB Output is correct
22 Correct 13 ms 9288 KB Output is correct
23 Correct 14 ms 9288 KB Output is correct
24 Correct 13 ms 9288 KB Output is correct
25 Correct 12 ms 9324 KB Output is correct
26 Correct 12 ms 9324 KB Output is correct
27 Correct 9 ms 9324 KB Output is correct
28 Correct 11 ms 9324 KB Output is correct
29 Correct 10 ms 9324 KB Output is correct
30 Correct 13 ms 9324 KB Output is correct
31 Correct 12 ms 9324 KB Output is correct
32 Correct 12 ms 9324 KB Output is correct
33 Correct 12 ms 9324 KB Output is correct
34 Correct 13 ms 9324 KB Output is correct
35 Correct 12 ms 9324 KB Output is correct
36 Correct 13 ms 9324 KB Output is correct
37 Correct 12 ms 9324 KB Output is correct
38 Correct 11 ms 9324 KB Output is correct
39 Correct 10 ms 9324 KB Output is correct
40 Correct 7 ms 9324 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 8952 KB Output is correct
2 Correct 12 ms 9060 KB Output is correct
3 Correct 12 ms 9060 KB Output is correct
4 Correct 13 ms 9060 KB Output is correct
5 Correct 10 ms 9084 KB Output is correct
6 Correct 10 ms 9100 KB Output is correct
7 Correct 11 ms 9288 KB Output is correct
8 Correct 12 ms 9288 KB Output is correct
9 Correct 12 ms 9288 KB Output is correct
10 Correct 13 ms 9288 KB Output is correct
11 Correct 13 ms 9288 KB Output is correct
12 Correct 12 ms 9288 KB Output is correct
13 Correct 14 ms 9288 KB Output is correct
14 Correct 12 ms 9288 KB Output is correct
15 Correct 14 ms 9288 KB Output is correct
16 Correct 7 ms 9288 KB Output is correct
17 Correct 11 ms 9288 KB Output is correct
18 Correct 12 ms 9288 KB Output is correct
19 Correct 12 ms 9288 KB Output is correct
20 Correct 11 ms 9288 KB Output is correct
21 Correct 13 ms 9288 KB Output is correct
22 Correct 13 ms 9288 KB Output is correct
23 Correct 14 ms 9288 KB Output is correct
24 Correct 13 ms 9288 KB Output is correct
25 Correct 12 ms 9324 KB Output is correct
26 Correct 12 ms 9324 KB Output is correct
27 Correct 9 ms 9324 KB Output is correct
28 Correct 11 ms 9324 KB Output is correct
29 Correct 10 ms 9324 KB Output is correct
30 Correct 13 ms 9324 KB Output is correct
31 Correct 12 ms 9324 KB Output is correct
32 Correct 12 ms 9324 KB Output is correct
33 Correct 12 ms 9324 KB Output is correct
34 Correct 13 ms 9324 KB Output is correct
35 Correct 12 ms 9324 KB Output is correct
36 Correct 13 ms 9324 KB Output is correct
37 Correct 12 ms 9324 KB Output is correct
38 Correct 11 ms 9324 KB Output is correct
39 Correct 10 ms 9324 KB Output is correct
40 Correct 7 ms 9324 KB Output is correct
41 Correct 11 ms 9324 KB Output is correct
42 Correct 12 ms 9324 KB Output is correct
43 Correct 11 ms 9324 KB Output is correct
44 Correct 13 ms 9324 KB Output is correct
45 Correct 14 ms 9324 KB Output is correct
46 Correct 12 ms 9324 KB Output is correct
47 Correct 13 ms 9324 KB Output is correct
48 Correct 14 ms 9324 KB Output is correct
49 Correct 12 ms 9324 KB Output is correct
50 Correct 14 ms 9324 KB Output is correct
51 Correct 11 ms 9324 KB Output is correct
52 Correct 12 ms 9324 KB Output is correct
53 Correct 23 ms 9324 KB Output is correct
54 Correct 10 ms 9324 KB Output is correct
55 Correct 12 ms 9324 KB Output is correct
56 Correct 13 ms 9324 KB Output is correct
57 Correct 12 ms 9324 KB Output is correct
58 Correct 12 ms 9324 KB Output is correct
59 Correct 11 ms 9324 KB Output is correct
60 Correct 10 ms 9324 KB Output is correct
61 Correct 12 ms 9324 KB Output is correct
62 Correct 14 ms 9324 KB Output is correct
63 Correct 25 ms 9324 KB Output is correct
64 Correct 12 ms 9324 KB Output is correct
65 Correct 9 ms 9324 KB Output is correct
66 Correct 13 ms 9324 KB Output is correct
67 Correct 13 ms 9324 KB Output is correct
68 Correct 11 ms 9324 KB Output is correct
69 Correct 14 ms 9324 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 8952 KB Output is correct
2 Correct 12 ms 9060 KB Output is correct
3 Correct 12 ms 9060 KB Output is correct
4 Correct 13 ms 9060 KB Output is correct
5 Correct 10 ms 9084 KB Output is correct
6 Correct 10 ms 9100 KB Output is correct
7 Correct 11 ms 9288 KB Output is correct
8 Correct 12 ms 9288 KB Output is correct
9 Correct 12 ms 9288 KB Output is correct
10 Correct 13 ms 9288 KB Output is correct
11 Correct 13 ms 9288 KB Output is correct
12 Correct 12 ms 9288 KB Output is correct
13 Correct 14 ms 9288 KB Output is correct
14 Correct 12 ms 9288 KB Output is correct
15 Correct 14 ms 9288 KB Output is correct
16 Correct 7 ms 9288 KB Output is correct
17 Correct 11 ms 9288 KB Output is correct
18 Correct 12 ms 9288 KB Output is correct
19 Correct 12 ms 9288 KB Output is correct
20 Correct 11 ms 9288 KB Output is correct
21 Correct 13 ms 9288 KB Output is correct
22 Correct 13 ms 9288 KB Output is correct
23 Correct 14 ms 9288 KB Output is correct
24 Correct 13 ms 9288 KB Output is correct
25 Correct 12 ms 9324 KB Output is correct
26 Correct 12 ms 9324 KB Output is correct
27 Correct 9 ms 9324 KB Output is correct
28 Correct 11 ms 9324 KB Output is correct
29 Correct 10 ms 9324 KB Output is correct
30 Correct 13 ms 9324 KB Output is correct
31 Correct 12 ms 9324 KB Output is correct
32 Correct 12 ms 9324 KB Output is correct
33 Correct 12 ms 9324 KB Output is correct
34 Correct 13 ms 9324 KB Output is correct
35 Correct 12 ms 9324 KB Output is correct
36 Correct 13 ms 9324 KB Output is correct
37 Correct 12 ms 9324 KB Output is correct
38 Correct 11 ms 9324 KB Output is correct
39 Correct 10 ms 9324 KB Output is correct
40 Correct 7 ms 9324 KB Output is correct
41 Correct 11 ms 9324 KB Output is correct
42 Correct 12 ms 9324 KB Output is correct
43 Correct 11 ms 9324 KB Output is correct
44 Correct 13 ms 9324 KB Output is correct
45 Correct 14 ms 9324 KB Output is correct
46 Correct 12 ms 9324 KB Output is correct
47 Correct 13 ms 9324 KB Output is correct
48 Correct 14 ms 9324 KB Output is correct
49 Correct 12 ms 9324 KB Output is correct
50 Correct 14 ms 9324 KB Output is correct
51 Correct 11 ms 9324 KB Output is correct
52 Correct 12 ms 9324 KB Output is correct
53 Correct 23 ms 9324 KB Output is correct
54 Correct 10 ms 9324 KB Output is correct
55 Correct 12 ms 9324 KB Output is correct
56 Correct 13 ms 9324 KB Output is correct
57 Correct 12 ms 9324 KB Output is correct
58 Correct 12 ms 9324 KB Output is correct
59 Correct 11 ms 9324 KB Output is correct
60 Correct 10 ms 9324 KB Output is correct
61 Correct 12 ms 9324 KB Output is correct
62 Correct 14 ms 9324 KB Output is correct
63 Correct 25 ms 9324 KB Output is correct
64 Correct 12 ms 9324 KB Output is correct
65 Correct 9 ms 9324 KB Output is correct
66 Correct 13 ms 9324 KB Output is correct
67 Correct 13 ms 9324 KB Output is correct
68 Correct 11 ms 9324 KB Output is correct
69 Correct 14 ms 9324 KB Output is correct
70 Correct 14 ms 9324 KB Output is correct
71 Correct 218 ms 9340 KB Output is correct
72 Correct 16 ms 9340 KB Output is correct
73 Correct 9 ms 9340 KB Output is correct
74 Correct 11 ms 9340 KB Output is correct
75 Correct 11 ms 9340 KB Output is correct
76 Correct 13 ms 9340 KB Output is correct
77 Correct 12 ms 9340 KB Output is correct
78 Correct 28 ms 9340 KB Output is correct
79 Correct 12 ms 9340 KB Output is correct
80 Correct 17 ms 9340 KB Output is correct
81 Correct 12 ms 9340 KB Output is correct
82 Correct 11 ms 9340 KB Output is correct
83 Correct 18 ms 9340 KB Output is correct
84 Correct 22 ms 9340 KB Output is correct
85 Correct 11 ms 9340 KB Output is correct
86 Correct 14 ms 9340 KB Output is correct
87 Correct 20 ms 9340 KB Output is correct
88 Correct 10 ms 9340 KB Output is correct
89 Correct 131 ms 9340 KB Output is correct
90 Correct 23 ms 10236 KB Output is correct
91 Correct 11 ms 10236 KB Output is correct
92 Correct 11 ms 10236 KB Output is correct
93 Correct 12 ms 10236 KB Output is correct
94 Correct 11 ms 10236 KB Output is correct
95 Correct 11 ms 10236 KB Output is correct
96 Correct 21 ms 10236 KB Output is correct
97 Correct 24 ms 10236 KB Output is correct
98 Correct 16 ms 10236 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 10236 KB Output is correct
2 Correct 14 ms 10236 KB Output is correct
3 Correct 22 ms 10236 KB Output is correct
4 Correct 29 ms 10236 KB Output is correct
5 Correct 73 ms 11256 KB Output is correct
6 Correct 82 ms 11256 KB Output is correct
7 Correct 67 ms 11624 KB Output is correct
8 Correct 12 ms 11624 KB Output is correct
9 Correct 20 ms 11624 KB Output is correct
10 Correct 84 ms 11624 KB Output is correct
11 Correct 65 ms 11624 KB Output is correct
12 Correct 58 ms 11708 KB Output is correct
13 Correct 13 ms 11708 KB Output is correct
14 Correct 10 ms 11708 KB Output is correct
15 Correct 74 ms 11708 KB Output is correct
16 Correct 25 ms 11708 KB Output is correct
17 Correct 68 ms 11708 KB Output is correct
18 Correct 45 ms 11708 KB Output is correct
19 Correct 12 ms 11708 KB Output is correct
20 Correct 56 ms 11776 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 8952 KB Output is correct
2 Correct 12 ms 9060 KB Output is correct
3 Correct 12 ms 9060 KB Output is correct
4 Correct 13 ms 9060 KB Output is correct
5 Correct 10 ms 9084 KB Output is correct
6 Correct 10 ms 9100 KB Output is correct
7 Correct 11 ms 9288 KB Output is correct
8 Correct 12 ms 9288 KB Output is correct
9 Correct 12 ms 9288 KB Output is correct
10 Correct 13 ms 9288 KB Output is correct
11 Correct 13 ms 9288 KB Output is correct
12 Correct 12 ms 9288 KB Output is correct
13 Correct 14 ms 9288 KB Output is correct
14 Correct 12 ms 9288 KB Output is correct
15 Correct 14 ms 9288 KB Output is correct
16 Correct 7 ms 9288 KB Output is correct
17 Correct 11 ms 9288 KB Output is correct
18 Correct 12 ms 9288 KB Output is correct
19 Correct 12 ms 9288 KB Output is correct
20 Correct 11 ms 9288 KB Output is correct
21 Correct 13 ms 9288 KB Output is correct
22 Correct 13 ms 9288 KB Output is correct
23 Correct 14 ms 9288 KB Output is correct
24 Correct 13 ms 9288 KB Output is correct
25 Correct 12 ms 9324 KB Output is correct
26 Correct 12 ms 9324 KB Output is correct
27 Correct 9 ms 9324 KB Output is correct
28 Correct 11 ms 9324 KB Output is correct
29 Correct 10 ms 9324 KB Output is correct
30 Correct 13 ms 9324 KB Output is correct
31 Correct 12 ms 9324 KB Output is correct
32 Correct 12 ms 9324 KB Output is correct
33 Correct 12 ms 9324 KB Output is correct
34 Correct 13 ms 9324 KB Output is correct
35 Correct 12 ms 9324 KB Output is correct
36 Correct 13 ms 9324 KB Output is correct
37 Correct 12 ms 9324 KB Output is correct
38 Correct 11 ms 9324 KB Output is correct
39 Correct 10 ms 9324 KB Output is correct
40 Correct 7 ms 9324 KB Output is correct
41 Correct 11 ms 9324 KB Output is correct
42 Correct 12 ms 9324 KB Output is correct
43 Correct 11 ms 9324 KB Output is correct
44 Correct 13 ms 9324 KB Output is correct
45 Correct 14 ms 9324 KB Output is correct
46 Correct 12 ms 9324 KB Output is correct
47 Correct 13 ms 9324 KB Output is correct
48 Correct 14 ms 9324 KB Output is correct
49 Correct 12 ms 9324 KB Output is correct
50 Correct 14 ms 9324 KB Output is correct
51 Correct 11 ms 9324 KB Output is correct
52 Correct 12 ms 9324 KB Output is correct
53 Correct 23 ms 9324 KB Output is correct
54 Correct 10 ms 9324 KB Output is correct
55 Correct 12 ms 9324 KB Output is correct
56 Correct 13 ms 9324 KB Output is correct
57 Correct 12 ms 9324 KB Output is correct
58 Correct 12 ms 9324 KB Output is correct
59 Correct 11 ms 9324 KB Output is correct
60 Correct 10 ms 9324 KB Output is correct
61 Correct 12 ms 9324 KB Output is correct
62 Correct 14 ms 9324 KB Output is correct
63 Correct 25 ms 9324 KB Output is correct
64 Correct 12 ms 9324 KB Output is correct
65 Correct 9 ms 9324 KB Output is correct
66 Correct 13 ms 9324 KB Output is correct
67 Correct 13 ms 9324 KB Output is correct
68 Correct 11 ms 9324 KB Output is correct
69 Correct 14 ms 9324 KB Output is correct
70 Correct 14 ms 9324 KB Output is correct
71 Correct 218 ms 9340 KB Output is correct
72 Correct 16 ms 9340 KB Output is correct
73 Correct 9 ms 9340 KB Output is correct
74 Correct 11 ms 9340 KB Output is correct
75 Correct 11 ms 9340 KB Output is correct
76 Correct 13 ms 9340 KB Output is correct
77 Correct 12 ms 9340 KB Output is correct
78 Correct 28 ms 9340 KB Output is correct
79 Correct 12 ms 9340 KB Output is correct
80 Correct 17 ms 9340 KB Output is correct
81 Correct 12 ms 9340 KB Output is correct
82 Correct 11 ms 9340 KB Output is correct
83 Correct 18 ms 9340 KB Output is correct
84 Correct 22 ms 9340 KB Output is correct
85 Correct 11 ms 9340 KB Output is correct
86 Correct 14 ms 9340 KB Output is correct
87 Correct 20 ms 9340 KB Output is correct
88 Correct 10 ms 9340 KB Output is correct
89 Correct 131 ms 9340 KB Output is correct
90 Correct 23 ms 10236 KB Output is correct
91 Correct 11 ms 10236 KB Output is correct
92 Correct 11 ms 10236 KB Output is correct
93 Correct 12 ms 10236 KB Output is correct
94 Correct 11 ms 10236 KB Output is correct
95 Correct 11 ms 10236 KB Output is correct
96 Correct 21 ms 10236 KB Output is correct
97 Correct 24 ms 10236 KB Output is correct
98 Correct 16 ms 10236 KB Output is correct
99 Correct 37 ms 10236 KB Output is correct
100 Correct 14 ms 10236 KB Output is correct
101 Correct 22 ms 10236 KB Output is correct
102 Correct 29 ms 10236 KB Output is correct
103 Correct 73 ms 11256 KB Output is correct
104 Correct 82 ms 11256 KB Output is correct
105 Correct 67 ms 11624 KB Output is correct
106 Correct 12 ms 11624 KB Output is correct
107 Correct 20 ms 11624 KB Output is correct
108 Correct 84 ms 11624 KB Output is correct
109 Correct 65 ms 11624 KB Output is correct
110 Correct 58 ms 11708 KB Output is correct
111 Correct 13 ms 11708 KB Output is correct
112 Correct 10 ms 11708 KB Output is correct
113 Correct 74 ms 11708 KB Output is correct
114 Correct 25 ms 11708 KB Output is correct
115 Correct 68 ms 11708 KB Output is correct
116 Correct 45 ms 11708 KB Output is correct
117 Correct 12 ms 11708 KB Output is correct
118 Correct 56 ms 11776 KB Output is correct
119 Correct 22 ms 11776 KB Output is correct
120 Incorrect 49 ms 12488 KB 'impossible' claimed, but there is a solution
121 Halted 0 ms 0 KB -