#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;
for(int i = 0; i < 7; 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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
504 KB |
Output is correct |
3 |
Execution timed out |
1068 ms |
640 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |