結果

問題 No.2159 Filling 4x4 array
ユーザー hotman78
提出日時 2022-10-30 18:14:41
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 715 bytes
コンパイル時間 756 ms
コンパイル使用メモリ 72,288 KB
最終ジャッジ日時 2025-02-08 16:10:11
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 3 TLE * 1
other WA * 20 TLE * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
using namespace std;
int H[3], W[3], ans = 0;
int main() {
  for (int i = 0; i < 3; i++) cin >> H[i];
  for (int j = 0; j < 3; j++) cin >> W[j];
  int mx=0;
  for (int i = 0; i < 3; i++){
    if(mx < H[i])mx=H[i];
    if(mx < W[i])mx=W[i];
  }
  for (int a = 1; a <= mx; a++) {
    for (int b = 1; b <= mx; b++) {
      for (int d = 1; d <= mx; d++) {
        for (int e = 1; e <= mx; e++) {
          int c = H[0] - a - b;
          int f = H[1] - d - e;
          int g = W[0] - a - d;
          int h = W[1] - b - e;
          int i = W[2] - c - f;
          if (min({c, f, g, h, i}) > 0 and g + h + i == H[2]) ans++;
        }
      }
    }
  }
  cout << ans << "\n";
}
0