提出 #63829431
ソースコード 拡げる
#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG //[]で配列外参照をするとエラーにしてくれる。上下のやつがないとTLEになるので注意 ABC311Eのサンプル4みたいなデバック中のTLEは防げないので注意
#endif
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
using ll = long long;
ll INF = 2e18;
using P = pair<ll, ll>;
#define pb push_back
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reprev(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define for_(i, a, b) for (ll i = (a); i < (b); i++)
#define all(v) v.begin(), v.end()
template <typename T>
inline bool chmin(T &a, const T &b)
{
bool c = a > b;
if (c)
a = b;
return c;
}
template <typename T>
inline bool chmax(T &a, const T &b)
{
bool c = a < b;
if (c)
a = b;
return c;
}
template <typename T>
inline T ceil(T a, T b) { return (a + (b - 1)) / b; }
using mint = modint998244353;
// using mint = modint1000000007;
// using mint = static_modint<10>;//使うときはコメントアウトを外す
template <typename T>
using vc = vector<T>;
template <class T>
istream &operator>>(istream &i, vc<T> &v)
{
rep(j, size(v)) i >> v[j];
return i;
}
template <class T>
ostream &operator<<(ostream &o, const vc<T> &v)
{
rep(j, size(v))
{
if (j)
o << " ";
o << v[j];
}
o << endl;
return o;
}
int main()
{
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
// ref:https://rsk0315.hatenablog.com/entry/2020/05/09/170315
ll N;
cin >> N;
ll x = 0;
while ((x) * (x) * (x) - (x - 1) * (x - 1) * (x - 1) <= N)
{
ll y_pow_3 = (x) * (x) * (x)-N;
ll y = pow(y_pow_3, 1.0 / 3.0);
for_(i, -2, 3)
{
if (y + i > 0 && y + i < x && (y + i) * (y + i) * (y + i) == y_pow_3)
{
cout << x << " " << y + i << endl;
return 0;
}
}
x++;
}
cout << -1 << endl;
// cout << ans << endl;
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | D - Cubes |
| ユーザ | manybear |
| 言語 | C++ 23 (gcc 12.2) |
| 得点 | 0 |
| コード長 | 2074 Byte |
| 結果 | TLE |
| 実行時間 | 2210 ms |
| メモリ | 3864 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 0 / 425 | ||||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
| All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_test_00.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt, 01_test_21.txt, 01_test_22.txt, 01_test_23.txt, 01_test_24.txt, 01_test_25.txt, 01_test_26.txt, 01_test_27.txt, 01_test_28.txt, 01_test_29.txt, 01_test_30.txt, 01_test_31.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 00_sample_00.txt | AC | 1 ms | 3776 KiB |
| 00_sample_01.txt | AC | 1 ms | 3660 KiB |
| 00_sample_02.txt | AC | 4 ms | 3704 KiB |
| 01_test_00.txt | TLE | 2210 ms | 3452 KiB |
| 01_test_01.txt | TLE | 2207 ms | 3460 KiB |
| 01_test_02.txt | AC | 10 ms | 3632 KiB |
| 01_test_03.txt | AC | 11 ms | 3796 KiB |
| 01_test_04.txt | AC | 9 ms | 3864 KiB |
| 01_test_05.txt | TLE | 2207 ms | 3440 KiB |
| 01_test_06.txt | AC | 16 ms | 3836 KiB |
| 01_test_07.txt | TLE | 2207 ms | 3464 KiB |
| 01_test_08.txt | AC | 11 ms | 3836 KiB |
| 01_test_09.txt | TLE | 2207 ms | 3464 KiB |
| 01_test_10.txt | TLE | 2207 ms | 3340 KiB |
| 01_test_11.txt | AC | 21 ms | 3772 KiB |
| 01_test_12.txt | AC | 8 ms | 3628 KiB |
| 01_test_13.txt | AC | 6 ms | 3784 KiB |
| 01_test_14.txt | AC | 5 ms | 3728 KiB |
| 01_test_15.txt | TLE | 2207 ms | 3436 KiB |
| 01_test_16.txt | TLE | 2207 ms | 3532 KiB |
| 01_test_17.txt | TLE | 2207 ms | 3512 KiB |
| 01_test_18.txt | TLE | 2207 ms | 3544 KiB |
| 01_test_19.txt | TLE | 2207 ms | 3472 KiB |
| 01_test_20.txt | TLE | 2210 ms | 3440 KiB |
| 01_test_21.txt | TLE | 2207 ms | 3544 KiB |
| 01_test_22.txt | TLE | 2207 ms | 3340 KiB |
| 01_test_23.txt | TLE | 2207 ms | 3476 KiB |
| 01_test_24.txt | AC | 1 ms | 3780 KiB |
| 01_test_25.txt | AC | 1 ms | 3632 KiB |
| 01_test_26.txt | AC | 1 ms | 3712 KiB |
| 01_test_27.txt | AC | 1 ms | 3832 KiB |
| 01_test_28.txt | AC | 1 ms | 3732 KiB |
| 01_test_29.txt | AC | 1 ms | 3704 KiB |
| 01_test_30.txt | AC | 1 ms | 3632 KiB |
| 01_test_31.txt | AC | 5 ms | 3732 KiB |