結果

問題 No.384 マス埋めゲーム2
ユーザー bkaclubbkaclub
提出日時 2016-07-02 07:24:22
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,139 bytes
コンパイル時間 576 ms
コンパイル使用メモリ 72,960 KB
実行使用メモリ 13,880 KB
最終ジャッジ日時 2024-04-20 07:12:48
合計ジャッジ時間 3,153 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
13,880 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#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);

}
0