#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200100;
const int ALPHA = 10000;
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;
for(int i = 0; i < N * ALPHA; 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 |
673 ms |
488 KB |
Output is correct |
2 |
Execution timed out |
1057 ms |
376 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |