Submission #138608

# Submission time Handle Problem Language Result Execution time Memory
138608 2019-07-30T07:17:52 Z 임유진(#3321) Who wants to live forever? (CERC12_B) C++14
0 / 1
1000 ms 908 KB
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 200100;

char inp[MAXN];
bitset<MAXN> A, B;

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	int T;

	cin >> T;
	while(T--) {
		cin >> inp;
		int N;
		for(N = 0; inp[N]; N++);
		for(int i = 0; i < N; i++) A[i + 1] = inp[i] - '0';
		A[0] = A[N + 1] = false;
		if(N % 2) for(int i = 0; i < 6; i++) {
			for(int j = 1; j <= N; j++) B[j] = A[j - 1] ^ A[j + 1];
			swap(A, B);
		}
		bool live = false;
		for(int i = 1; i <= N; i++) live |= A[i];
		if(live) cout << "LIVES\n";
		else cout << "DIES\n";
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Execution timed out 1071 ms 908 KB Time limit exceeded
4 Halted 0 ms 0 KB -