結果
| 問題 |
No.384 マス埋めゲーム2
|
| コンテスト | |
| ユーザー |
bkaclub
|
| 提出日時 | 2016-07-02 07:24:22 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,139 bytes |
| コンパイル時間 | 577 ms |
| コンパイル使用メモリ | 72,572 KB |
| 実行使用メモリ | 13,632 KB |
| 最終ジャッジ日時 | 2024-10-12 02:20:57 |
| 合計ジャッジ時間 | 3,161 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 TLE * 1 -- * 13 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:32:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
32 | scanf("%lld %lld", &h,&w);
| ~~~~~^~~~~~~~~~~~~~~~~~~~
main.cpp:33:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
33 | scanf("%lld %lld", &n,&k);
| ~~~~~^~~~~~~~~~~~~~~~~~~~
ソースコード
#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