Submission #138459

# Submission time Handle Problem Language Result Execution time Memory
138459 2019-07-30T03:51:07 Z 윤교준(#3320) Who wants to live forever? (CERC12_B) C++14
0 / 1
2 ms 376 KB
#include <bits/stdc++.h>
#define eb emplace_back
#define sz(V) ((int)(V).size())
#define allv(V) ((V).begin()),((V).end())
#define rb(x) ((x)&(-(x)))
using namespace std;
typedef pair<int, int> pii;

const int MAXN = 200055;

int A[MAXN];
char B[MAXN];

int T, N;

void run() {
	cin >> B;
	N = strlen(B);
	for(int i = 0; i < N; i++) A[i] = B[i] & 1;

	for(int k = 1; k-1 <= N; k <<= 1) if(k-1 == N) {
		puts("DIES");
		return;
	}

	{
		bool flag = false;
		for(int i = 0; i < N; i++)
			if(A[i]) flag = true;
		if(!flag) {
			puts("DIES");
			return;
		}
	}

	if(N&1) {
		bool flag = false;
		for(int i = 0; i < N; i++)
			if(A[i] == (i&1)) {
				flag = true;
			}
		if(!flag) {
			puts("DIES");
			return;
		}
	}

	puts("LIVES");
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	for(cin >> T; T--;) run();
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -