結果
| 問題 | No.384 マス埋めゲーム2 |
| コンテスト | |
| ユーザー |
bkaclub
|
| 提出日時 | 2016-07-02 07:24:22 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,139 bytes |
| 記録 | |
| コンパイル時間 | 708 ms |
| コンパイル使用メモリ | 96,344 KB |
| 実行使用メモリ | 13,056 KB |
| 最終ジャッジ日時 | 2026-04-28 13:14:53 |
| 合計ジャッジ時間 | 3,360 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 TLE * 1 -- * 13 |
ソースコード
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
using namespace std;
#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
typedef long long ll;
bool dfs(ll h,ll w,ll n,ll k);
int main(){
ll h=0,w=0,n=0,k=0;
scanf("%lld %lld", &h,&w);
scanf("%lld %lld", &n,&k);
if(dfs(h,w,n,k)) printf("YES\n");
else printf("NO\n");
return 0;
}
bool dfs(ll h,ll w,ll n,ll k){
if(h==1){if((w % n)==k||((n==k)&&(w % n)==0)) return true; else return false;}
else if(w==1){if((h % n)==k||((n==k)&&(h % n)==0)) return true; else return false;}
if(k==1) return dfs(h-1,w,n,n)&&dfs(h,w-1,n,n);
else return dfs(h-1,w,n,k-1)&&dfs(h,w-1,n,k-1);
}
bkaclub