結果

問題 No.540 格子点と経路
ユーザー LayCurseLayCurse
提出日時 2017-06-30 23:30:05
言語 cLay
(20240104-1)
結果
WA  
実行時間 -
コード長 311 bytes
コンパイル時間 1,840 ms
コンパイル使用メモリ 158,868 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-18 23:23:06
合計ジャッジ時間 3,209 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 WA -
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 2 ms
4,380 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// わからん

ll solve(ll X, ll Y){
  if(X==0 && Y==0) return 0;
  if(X==0 || Y==0) return 1;

  if(X==Y && X%2==0) return (X+1) * (Y+1) - max(X,Y) - 1;
  if(X%2==0 && Y%2==0) return (X+1) * (Y+1) - max(X,Y);
  return (X+1) * (Y+1) - max(X,Y) + 2;
}
{
  ll X, Y, r;
  rd(X, Y);
  r = solve(X, Y);
  wt(r);
}
0