Submission #63817473
Source Code Expand
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <unordered_map>
using namespace std;
long long n;
unordered_map<long long, int> mp;
long long sqr(long long a)
{
long long ret = sqrt(a);
if (ret * ret != a)
return -1;
return ret;
}
int main()
{
cin >> n; n *= 4;
for (long long b = 1; b * b * b <= n; b++)
{
if (n % b != 0) continue;
long long a = n / b - 1LL * b * b;
if (a % 3) continue; a /= 3;
a = sqr(a); if (a == -1) continue;
if (a % 2 != b % 2) continue;
long long x = (a + b) / 2;
long long y = (a - b) / 2;
if (x < 1 || y < 1) continue;
cout << x << " " << y << endl;
return 0;
}
cout << "-1" << endl;
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | D - Cubes |
| User | ArmeriaLeap |
| Language | C++ 20 (gcc 12.2) |
| Score | 425 |
| Code Size | 729 Byte |
| Status | AC |
| Exec Time | 6 ms |
| Memory | 3684 KiB |
Compile Error
Main.cpp: In function ‘int main()’:
Main.cpp:26:17: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
26 | if (a % 3) continue; a /= 3;
| ^~
Main.cpp:26:38: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
26 | if (a % 3) continue; a /= 3;
| ^
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 425 / 425 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| 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 |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 1 ms | 3524 KiB |
| 00_sample_01.txt | AC | 1 ms | 3448 KiB |
| 00_sample_02.txt | AC | 2 ms | 3404 KiB |
| 01_test_00.txt | AC | 4 ms | 3496 KiB |
| 01_test_01.txt | AC | 5 ms | 3396 KiB |
| 01_test_02.txt | AC | 3 ms | 3516 KiB |
| 01_test_03.txt | AC | 4 ms | 3528 KiB |
| 01_test_04.txt | AC | 3 ms | 3500 KiB |
| 01_test_05.txt | AC | 1 ms | 3496 KiB |
| 01_test_06.txt | AC | 2 ms | 3548 KiB |
| 01_test_07.txt | AC | 1 ms | 3508 KiB |
| 01_test_08.txt | AC | 4 ms | 3436 KiB |
| 01_test_09.txt | AC | 5 ms | 3460 KiB |
| 01_test_10.txt | AC | 5 ms | 3516 KiB |
| 01_test_11.txt | AC | 2 ms | 3680 KiB |
| 01_test_12.txt | AC | 3 ms | 3480 KiB |
| 01_test_13.txt | AC | 2 ms | 3520 KiB |
| 01_test_14.txt | AC | 3 ms | 3396 KiB |
| 01_test_15.txt | AC | 1 ms | 3684 KiB |
| 01_test_16.txt | AC | 1 ms | 3524 KiB |
| 01_test_17.txt | AC | 1 ms | 3608 KiB |
| 01_test_18.txt | AC | 1 ms | 3452 KiB |
| 01_test_19.txt | AC | 1 ms | 3508 KiB |
| 01_test_20.txt | AC | 1 ms | 3476 KiB |
| 01_test_21.txt | AC | 6 ms | 3480 KiB |
| 01_test_22.txt | AC | 6 ms | 3468 KiB |
| 01_test_23.txt | AC | 5 ms | 3616 KiB |
| 01_test_24.txt | AC | 1 ms | 3616 KiB |
| 01_test_25.txt | AC | 1 ms | 3520 KiB |
| 01_test_26.txt | AC | 1 ms | 3448 KiB |
| 01_test_27.txt | AC | 1 ms | 3532 KiB |
| 01_test_28.txt | AC | 1 ms | 3536 KiB |
| 01_test_29.txt | AC | 1 ms | 3436 KiB |
| 01_test_30.txt | AC | 1 ms | 3492 KiB |
| 01_test_31.txt | AC | 2 ms | 3548 KiB |