結果

問題 No.375 立方体のN等分 (1)
ユーザー motimoti
提出日時 2016-06-04 23:31:22
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,414 bytes
コンパイル時間 2,151 ms
コンパイル使用メモリ 112,336 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-17 01:31:44
合計ジャッジ時間 5,454 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 WA -
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 55 ms
5,376 KB
testcase_06 AC 50 ms
5,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 50 ms
5,376 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 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 55 ms
5,376 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 51 ms
5,376 KB
testcase_31 AC 52 ms
5,376 KB
testcase_32 AC 49 ms
5,376 KB
testcase_33 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>
#include <fstream>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

int main() {

  ll N; cin >> N;

  ll INF = std::numeric_limits<ll>::max();
  ll ans = INF;

  REP(i, 1, min(500LL, N))
  REP(j, 1, min(500LL, N))
  REP(k, 1, min(500LL, N))
  if(N % i == 0 && N % j == 0 && N % k == 0) {
    rep(a, 2) rep(b, 2) rep(c, 2) {
      ll ni = a ? i : N / i;
      ll nj = b ? j : N / j;
      ll nk = c ? k : N / k;
      if(ni * nj * nk == N) {
        minimize(ans, ni + nj + nk - 3);
      }
    }
  }

  cout << (ans == INF ? N - 1 : ans) << " " << N - 1 << endl;

  return 0;
}
0