Submission #63818076


Source Code Expand

Copy
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MAXN = 3e5 + 35, MAXT = 1e6;
ll n;
bool is_cbr(ll s) {
ll cbr = cbrt(s);
return(cbr * cbr * cbr == s);
}
int main(){
cin >> n;
for(ll i = 1; i * i * i <= n; i++) {//i = x - y;
// cout << i << ' ';
if(n % i)continue;
ll j = n / i - i * i;//j = 3xy;
// cout << j << ' ';
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include<bits/stdc++.h>

using namespace std;
using ll = long long;

const int MAXN = 3e5 + 35, MAXT = 1e6;

ll n;

bool is_cbr(ll s) {
	ll cbr = cbrt(s);
	return(cbr * cbr * cbr == s);
}

int main(){
	cin >> n;
	for(ll i = 1; i * i * i <= n; i++) {//i = x - y;
//		cout << i << ' ';
		if(n % i)continue;
		ll j = n / i - i * i;//j = 3xy;
//		cout << j << ' ';
		if(j % 3)continue;
		j /= 3;
		ll idj = sqrt(i * i + j * 4);//idj = x + y;
//		cout << idj << '\n';
		if((i + idj) % 2)continue;
		if(idj - i < 2)continue;
		ll x = (i + idj) / 2, y = (idj - i) / 2;
		if((x * x + x * y + y * y) == n / i){
			cout << x << ' ' << y;
			return 0;
		}
	}
	cout << -1;
	return 0;
}

Submission Info

Submission Time
Task D - Cubes
User yuhong056
Language C++ 20 (gcc 12.2)
Score 425
Code Size 708 Byte
Status AC
Exec Time 4 ms
Memory 3700 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 425 / 425
Status
AC × 3
AC × 35
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 3536 KB
00_sample_01.txt AC 1 ms 3436 KB
00_sample_02.txt AC 2 ms 3536 KB
01_test_00.txt AC 3 ms 3540 KB
01_test_01.txt AC 3 ms 3628 KB
01_test_02.txt AC 3 ms 3556 KB
01_test_03.txt AC 4 ms 3696 KB
01_test_04.txt AC 3 ms 3480 KB
01_test_05.txt AC 1 ms 3480 KB
01_test_06.txt AC 2 ms 3536 KB
01_test_07.txt AC 1 ms 3492 KB
01_test_08.txt AC 3 ms 3564 KB
01_test_09.txt AC 3 ms 3472 KB
01_test_10.txt AC 3 ms 3532 KB
01_test_11.txt AC 1 ms 3484 KB
01_test_12.txt AC 3 ms 3624 KB
01_test_13.txt AC 2 ms 3536 KB
01_test_14.txt AC 2 ms 3632 KB
01_test_15.txt AC 1 ms 3568 KB
01_test_16.txt AC 1 ms 3536 KB
01_test_17.txt AC 1 ms 3628 KB
01_test_18.txt AC 1 ms 3628 KB
01_test_19.txt AC 1 ms 3544 KB
01_test_20.txt AC 1 ms 3532 KB
01_test_21.txt AC 4 ms 3572 KB
01_test_22.txt AC 4 ms 3484 KB
01_test_23.txt AC 4 ms 3700 KB
01_test_24.txt AC 1 ms 3532 KB
01_test_25.txt AC 1 ms 3440 KB
01_test_26.txt AC 1 ms 3540 KB
01_test_27.txt AC 1 ms 3484 KB
01_test_28.txt AC 1 ms 3432 KB
01_test_29.txt AC 1 ms 3476 KB
01_test_30.txt AC 1 ms 3560 KB
01_test_31.txt AC 2 ms 3484 KB


2025-04-03 (Thu)
16:47:02 +00:00