Submission #5766887


Source Code Expand

#include <cstdio>

const int N = 2e5 + 5;

int n, A, B, C, D;
char s[N];

bool check(int x, int y) {
	for (int i = x + 1; i < y; i++) {
		if (s[i] == '#' && s[i + 1] == '#') return false;
	}
	return true;
}
bool Check(int x, int y) {
	for (int i = x; i <= y; i++) {
		if (s[i] == '.' && s[i - 1] != '#' && s[i + 1] != '#') return true;
	}
	return false;
}
int main() {
	scanf("%d%d%d%d%d%s", &n, &A, &B, &C, &D, s + 1);
	if (C < D) {
		printf("%s\n", check(A, C) && check(B, D) ? "Yes" : "No");
	} else {
		printf("%s\n", check(A, C) && Check(B, D) && check(B, D) ? "Yes" : "No");
	}
	return 0;
}

Submission Info

Submission Time
Task A - Kenken Race
User siyuan
Language C++14 (GCC 5.4.1)
Score 400
Code Size 623 Byte
Status AC
Exec Time 2 ms
Memory 384 KiB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:21:50: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%d%d%d%s", &n, &A, &B, &C, &D, s + 1);
                                                  ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 15
Set Name Test Cases
Sample example_00, example_01, example_02
All example_00, example_01, example_02, handmade_00, handmade_01, handmade_02, handmade_03, handmade_04, handmade_05, handmade_06, handmade_07, handmade_08, handmade_09, handmade_10, handmade_11
Case Name Status Exec Time Memory
example_00 AC 1 ms 128 KiB
example_01 AC 1 ms 128 KiB
example_02 AC 1 ms 128 KiB
handmade_00 AC 2 ms 384 KiB
handmade_01 AC 2 ms 384 KiB
handmade_02 AC 1 ms 384 KiB
handmade_03 AC 2 ms 384 KiB
handmade_04 AC 2 ms 384 KiB
handmade_05 AC 2 ms 384 KiB
handmade_06 AC 2 ms 384 KiB
handmade_07 AC 2 ms 384 KiB
handmade_08 AC 2 ms 384 KiB
handmade_09 AC 2 ms 384 KiB
handmade_10 AC 2 ms 384 KiB
handmade_11 AC 1 ms 384 KiB