Submission #63842416


Source Code Expand

Copy
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
const int N = 1e6 + 10;
ll a[N];
int main()
{
ll n;
cin >> n;
ll k = 0, k1 = 0;
ll x, y;
bool flag = true, flag1 = false;
for(ll i = 1; i <= 1000000; i++)
{
a[i] = i * i * i;
if(n == a[i])
{
flag = false;
break;
}
if(i > 1 && a[i] - a[i - 1] < n) k = i;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include<bits/stdc++.h>
#define ll long long int 
using namespace std;
const int N = 1e6 + 10;
ll a[N];
int main()
{
	ll n;
	cin >> n;
	ll k = 0, k1 = 0;
	ll x, y;
	bool flag = true, flag1 = false;
	for(ll i = 1; i <= 1000000; i++)
	{
		a[i] = i * i * i;
		if(n == a[i])
		{
			flag = false;
			break;
		}
		if(i > 1 && a[i] - a[i - 1] < n) k = i;
		if(a[i] < n) k1 = i;
	}
	if(flag)
	{
		for(ll i = k1 + 1; i <= k + 1; i++)
		{
			if(flag1) break;
			ll num = a[i] - n;
			for(int j = 1; num >= a[j]; j++)
			{
				if(a[i] - a[j] == n)
				{
					x = i;
					y = j;
					flag1 = true;
					break;
				}
			}	
		}	
	}
	if(flag1) cout << x << " " << y << endl;
	else cout << -1 << endl; 
	return 0;
}

Submission Info

Submission Time
Task D - Cubes
User ZH99
Language C++ 20 (gcc 12.2)
Score 0
Code Size 743 Byte
Status WA
Exec Time 2208 ms
Memory 11472 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 425
Status
AC × 3
AC × 19
WA × 4
TLE × 12
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 4 ms 11280 KB
00_sample_01.txt AC 1 ms 3552 KB
00_sample_02.txt AC 29 ms 11260 KB
01_test_00.txt TLE 2208 ms 11120 KB
01_test_01.txt TLE 2208 ms 11064 KB
01_test_02.txt AC 7 ms 11252 KB
01_test_03.txt AC 4 ms 11328 KB
01_test_04.txt AC 167 ms 11304 KB
01_test_05.txt TLE 2208 ms 11116 KB
01_test_06.txt TLE 2208 ms 11144 KB
01_test_07.txt WA 938 ms 11472 KB
01_test_08.txt AC 8 ms 11324 KB
01_test_09.txt TLE 2208 ms 11104 KB
01_test_10.txt TLE 2208 ms 11056 KB
01_test_11.txt TLE 2208 ms 11124 KB
01_test_12.txt AC 13 ms 11324 KB
01_test_13.txt AC 638 ms 11436 KB
01_test_14.txt AC 5 ms 11324 KB
01_test_15.txt WA 14 ms 11276 KB
01_test_16.txt TLE 2208 ms 11120 KB
01_test_17.txt TLE 2208 ms 11036 KB
01_test_18.txt TLE 2208 ms 11020 KB
01_test_19.txt TLE 2208 ms 11104 KB
01_test_20.txt WA 5 ms 11312 KB
01_test_21.txt AC 155 ms 11340 KB
01_test_22.txt TLE 2208 ms 11116 KB
01_test_23.txt AC 1949 ms 11320 KB
01_test_24.txt AC 4 ms 11324 KB
01_test_25.txt AC 4 ms 11440 KB
01_test_26.txt AC 4 ms 11344 KB
01_test_27.txt WA 5 ms 11308 KB
01_test_28.txt AC 5 ms 11444 KB
01_test_29.txt AC 5 ms 11324 KB
01_test_30.txt AC 4 ms 11368 KB
01_test_31.txt AC 7 ms 11280 KB


2025-04-01 (Tue)
17:19:05 +00:00