# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
138495 | 2019-07-30T05:36:08 Z | 김세빈(#3318) | Who wants to live forever? (CERC12_B) | C++14 | 21 ms | 10504 KB |
#include <bits/stdc++.h> using namespace std; bool tc(string &S) { int n, i, t; n = S.size(); t = (n + 1 ^ n) >> 1; for(i=0; i<n-t; i++){ if((i & t) == t){ if(S[i] != '0') return true; } else if(S[i] != S[i + (t - (i & t)) * 2]) return true; } return false; } int main() { ios::sync_with_stdio(false); cin.tie(NULL); string S; int t; cin >> t; for(; t--; ){ cin >> S; cout << (tc(S)? "LIVES" : "DIES") << "\n"; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 13 ms | 760 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 21 ms | 10504 KB | Output is correct |