提出 #50835911


ソースコード 拡げる

#include <bits/stdc++.h>

using namespace std;

int max(int a, int b, int c) {
  return max(a, max(b, c));
}

int min(int a, int b, int c) {
  return min(a, min(b, c));
}

long long len(int a, int b, int c) {
  return max(0, min(a, b, c) + 7 - max(a, b, c));
}

long long len(int a, int b) {
  return max(0, min(a, b) + 7 - max(a, b));
}

const int N = 11;

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);

  long long a, b, c;
  cin >> a >> b >> c;
  if (a + 2 * b + 3 * c != 3 * 343) {
    cout << "No\n";
    return 0;
  }
  int a1 = 0, b1 = 0, c1 = 0;
  for (int a2 = -N; a2 <= N; ++a2) {
    for (int b2 = -N; b2 <= N; ++b2) {
      for (int c2 = -N; c2 <= N; ++c2) {
        for (int a3 = -N; a3 <= N; ++a3) {
          for (int b3 = -N; b3 <= N; ++b3) {
            for (int c3 = -N; c3 <= N; ++c3) {
              long long V123 = len(a1, a2, a3) * len(b1, b2, b3) * len(c1, c2, c3);
              if (a2 == 0 and b2 == 6 and c2 == 0 and a3 == 6 and b3 == 0 and c3 == 0) {
                //cout << V123 << endl;
              }
              if (V123 == c) {
                //cout << a1 << ' ' << b1 << ' ' << c1 << ' ' << a2 << ' ' << b2 << ' ' << c2 << ' ' << a3 << ' ' << b3 << ' ' << c3 << endl;
                long long V12 = len(a1, a2) * len(b1, b2) * len(c1, c2) - V123;
                long long V13 = len(a1, a3) * len(b1, b3) * len(c1, c3) - V123;
                long long V23 = len(a2, a3) * len(b2, b3) * len(c2, c3) - V123;
                if (V12 + V13 + V23 == b) {
                  cout << "Yes\n";
                  cout << a1 << ' ' << b1 << ' ' << c1 << ' ' << a2 << ' ' << b2 << ' ' << c2 << ' ' << a3 << ' ' << b3 << ' ' << c3 << '\n';
                  return 0;
                }
              }
            }
          }
        }
      }
    }
  }
  cout << "No\n";

  return 0;
}

提出情報

提出日時
問題 E - 7x7x7
ユーザ achvanov
言語 C++ 20 (gcc 12.2)
得点 475
コード長 1903 Byte
結果 AC
実行時間 126 ms
メモリ 3636 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 475 / 475
結果
AC × 2
AC × 26
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt
All 00_sample_00.txt, 00_sample_01.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 02_random2_00.txt, 02_random2_01.txt, 02_random2_02.txt, 02_random2_03.txt, 02_random2_04.txt, 02_random2_05.txt, 02_random2_06.txt, 02_random2_07.txt, 02_random2_08.txt, 02_random2_09.txt, 03_killer_00.txt, 03_killer_01.txt, 04_killer2_00.txt, 04_killer2_01.txt, 05_handmade_00.txt, 05_handmade_01.txt, 05_handmade_02.txt, 05_handmade_03.txt, 05_handmade_04.txt, 05_handmade_05.txt, 05_handmade_06.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 59 ms 3572 KiB
00_sample_01.txt AC 1 ms 3444 KiB
01_random_00.txt AC 1 ms 3636 KiB
01_random_01.txt AC 1 ms 3496 KiB
01_random_02.txt AC 1 ms 3512 KiB
02_random2_00.txt AC 93 ms 3384 KiB
02_random2_01.txt AC 59 ms 3576 KiB
02_random2_02.txt AC 76 ms 3572 KiB
02_random2_03.txt AC 83 ms 3508 KiB
02_random2_04.txt AC 81 ms 3508 KiB
02_random2_05.txt AC 71 ms 3504 KiB
02_random2_06.txt AC 78 ms 3480 KiB
02_random2_07.txt AC 58 ms 3592 KiB
02_random2_08.txt AC 60 ms 3504 KiB
02_random2_09.txt AC 60 ms 3516 KiB
03_killer_00.txt AC 1 ms 3508 KiB
03_killer_01.txt AC 1 ms 3432 KiB
04_killer2_00.txt AC 59 ms 3504 KiB
04_killer2_01.txt AC 61 ms 3588 KiB
05_handmade_00.txt AC 1 ms 3408 KiB
05_handmade_01.txt AC 1 ms 3408 KiB
05_handmade_02.txt AC 1 ms 3408 KiB
05_handmade_03.txt AC 1 ms 3412 KiB
05_handmade_04.txt AC 126 ms 3448 KiB
05_handmade_05.txt AC 1 ms 3480 KiB
05_handmade_06.txt AC 115 ms 3404 KiB