Submission #52746970


Source Code Expand

#include <bits/stdc++.h>
#define f first
#define s second
#define ll long long
using namespace std;
int msk, n;
int x[10], y[10];
bool f(int h, int w){
	if (!h or !w)return true;
	bool yo = false;
	for (int i = 0; i < n; i++){
		if (msk & (1 << i))continue;
		msk ^= (1 << i);
		for (int j = 0; j < 3; j++){
			if (x[i] <= h and y[i] <= w){
				yo |= (f(h - x[i], w) & f(x[i], w - y[i]));
				yo |= (f(h - x[i], y[i]) & f(h, w - y[i]));
			}
			swap(x[i], y[i]);
		}
		msk ^= (1 << i);
	}
	return yo;
}

int main (){
	int h, w; cin >> n >> h >> w;
	msk = 0;
	for (int i = 0; i < n; i++){
		cin >> x[i] >> y[i];
	}
	cout << (f(h, w) ? "Yes" : "No") << '\n';
	return 0;
}

Submission Info

Submission Time
Task D - Tiling
User r4m1m
Language C++ 20 (gcc 12.2)
Score 0
Code Size 702 Byte
Status WA
Exec Time 2207 ms
Memory 3692 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 450
Status
AC × 4
AC × 74
WA × 4
TLE × 4
Set Name Test Cases
Sample example_00.txt, example_01.txt, example_02.txt, example_03.txt
All example_00.txt, example_01.txt, example_02.txt, example_03.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.txt, hand_10.txt, hand_11.txt, hand_12.txt, hand_13.txt, hand_14.txt, hand_15.txt, hand_16.txt, hand_17.txt, hand_18.txt, hand_19.txt, hand_20.txt, hand_21.txt, hand_22.txt, hand_23.txt, hand_24.txt, hand_25.txt, hand_26.txt, hand_27.txt, hand_28.txt, hand_29.txt, hand_30.txt, hand_31.txt, hand_32.txt, hand_33.txt, hand_34.txt, hand_35.txt, random2_00.txt, random2_01.txt, random2_02.txt, random2_03.txt, random2_04.txt, random2_05.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, random_27.txt, random_28.txt, random_29.txt, random_30.txt, random_31.txt, random_32.txt, random_33.txt, random_34.txt, random_35.txt
Case Name Status Exec Time Memory
example_00.txt AC 1 ms 3640 KiB
example_01.txt AC 1 ms 3552 KiB
example_02.txt AC 1 ms 3604 KiB
example_03.txt AC 1 ms 3500 KiB
hand_00.txt WA 1 ms 3508 KiB
hand_01.txt AC 1 ms 3640 KiB
hand_02.txt AC 1 ms 3692 KiB
hand_03.txt AC 1 ms 3424 KiB
hand_04.txt AC 1 ms 3648 KiB
hand_05.txt TLE 2207 ms 3292 KiB
hand_06.txt AC 90 ms 3520 KiB
hand_07.txt AC 14 ms 3508 KiB
hand_08.txt AC 1 ms 3552 KiB
hand_09.txt AC 4 ms 3504 KiB
hand_10.txt AC 1 ms 3428 KiB
hand_11.txt AC 1 ms 3460 KiB
hand_12.txt AC 1 ms 3452 KiB
hand_13.txt AC 1 ms 3476 KiB
hand_14.txt AC 1 ms 3428 KiB
hand_15.txt AC 4 ms 3548 KiB
hand_16.txt AC 3 ms 3500 KiB
hand_17.txt AC 3 ms 3476 KiB
hand_18.txt AC 1 ms 3556 KiB
hand_19.txt AC 1 ms 3460 KiB
hand_20.txt AC 14 ms 3692 KiB
hand_21.txt AC 12 ms 3552 KiB
hand_22.txt AC 1 ms 3504 KiB
hand_23.txt AC 1 ms 3452 KiB
hand_24.txt AC 1 ms 3548 KiB
hand_25.txt AC 1 ms 3452 KiB
hand_26.txt TLE 2207 ms 3300 KiB
hand_27.txt TLE 2207 ms 3216 KiB
hand_28.txt TLE 2207 ms 3252 KiB
hand_29.txt AC 1885 ms 3496 KiB
hand_30.txt AC 1859 ms 3472 KiB
hand_31.txt AC 1898 ms 3544 KiB
hand_32.txt AC 1 ms 3428 KiB
hand_33.txt AC 1 ms 3428 KiB
hand_34.txt AC 1 ms 3548 KiB
hand_35.txt WA 2 ms 3556 KiB
random2_00.txt AC 1 ms 3608 KiB
random2_01.txt AC 1 ms 3460 KiB
random2_02.txt AC 1 ms 3548 KiB
random2_03.txt AC 1 ms 3504 KiB
random2_04.txt AC 1 ms 3556 KiB
random2_05.txt AC 39 ms 3476 KiB
random_00.txt AC 1 ms 3496 KiB
random_01.txt AC 1 ms 3612 KiB
random_02.txt AC 1 ms 3688 KiB
random_03.txt AC 2 ms 3476 KiB
random_04.txt AC 1 ms 3496 KiB
random_05.txt AC 1 ms 3516 KiB
random_06.txt AC 26 ms 3604 KiB
random_07.txt AC 2 ms 3480 KiB
random_08.txt AC 1 ms 3496 KiB
random_09.txt AC 6 ms 3684 KiB
random_10.txt AC 1 ms 3500 KiB
random_11.txt AC 1 ms 3684 KiB
random_12.txt AC 1 ms 3564 KiB
random_13.txt AC 2 ms 3556 KiB
random_14.txt WA 82 ms 3460 KiB
random_15.txt AC 1 ms 3632 KiB
random_16.txt AC 1 ms 3456 KiB
random_17.txt AC 1 ms 3500 KiB
random_18.txt AC 1 ms 3512 KiB
random_19.txt AC 1 ms 3480 KiB
random_20.txt AC 2 ms 3684 KiB
random_21.txt AC 95 ms 3504 KiB
random_22.txt AC 1 ms 3656 KiB
random_23.txt AC 1 ms 3544 KiB
random_24.txt AC 178 ms 3500 KiB
random_25.txt AC 1 ms 3460 KiB
random_26.txt AC 2 ms 3656 KiB
random_27.txt AC 94 ms 3452 KiB
random_28.txt AC 5 ms 3500 KiB
random_29.txt AC 70 ms 3552 KiB
random_30.txt AC 843 ms 3556 KiB
random_31.txt AC 96 ms 3508 KiB
random_32.txt AC 31 ms 3496 KiB
random_33.txt AC 7 ms 3504 KiB
random_34.txt WA 40 ms 3464 KiB
random_35.txt AC 18 ms 3452 KiB