#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;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
- |