Submission #138626

# Submission time Handle Problem Language Result Execution time Memory
138626 2019-07-30T07:40:37 Z 송준혁(#3322) Who wants to live forever? (CERC12_B) C++14
0 / 1
2 ms 376 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

int TC, N;
char str[202020];

int main(){
	scanf("%d", &TC);
	while (TC--){
		scanf("%s", str+1);
		N = strlen(str+1);
		str[0] = str[N+1] = '0';
		if (N & 1){
			bool tf = true;
			for (int i=1; i<=N; i++){
				if('0' + ((str[i-1]-'0') ^ (str[i+1]-'0')) != str[i]){
					tf = false;
					break;
				}
			}
			if (!tf){
				puts("DIES");
				continue;
			}
		}
		sort(str+1, str+N+1);
		puts((str[N] == '0') ? "DIES" : "LIVES");
	}
	return 0;
}

Compilation message

B.cpp: In function 'int main()':
B.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &TC);
  ~~~~~^~~~~~~~~~~
B.cpp:12:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s", str+1);
   ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -