Task: | Gas tank |
Sender: | aalto2024k_001 |
Submission time: | 2024-11-13 16:50:56 +0200 |
Language: | C++ (C++17) |
Status: | READY |
Result: | TIME LIMIT EXCEEDED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.00 s | details |
#2 | ACCEPTED | 0.00 s | details |
#3 | ACCEPTED | 0.00 s | details |
#4 | ACCEPTED | 0.00 s | details |
#5 | ACCEPTED | 0.00 s | details |
#6 | ACCEPTED | 0.00 s | details |
#7 | ACCEPTED | 0.00 s | details |
#8 | ACCEPTED | 0.00 s | details |
#9 | ACCEPTED | 0.00 s | details |
#10 | ACCEPTED | 0.00 s | details |
#11 | ACCEPTED | 0.00 s | details |
#12 | ACCEPTED | 0.00 s | details |
#13 | ACCEPTED | 0.00 s | details |
#14 | ACCEPTED | 0.00 s | details |
#15 | ACCEPTED | 0.00 s | details |
#16 | ACCEPTED | 0.00 s | details |
#17 | ACCEPTED | 0.00 s | details |
#18 | ACCEPTED | 0.00 s | details |
#19 | ACCEPTED | 0.00 s | details |
#20 | ACCEPTED | 0.00 s | details |
#21 | ACCEPTED | 0.00 s | details |
#22 | ACCEPTED | 0.00 s | details |
#23 | ACCEPTED | 0.00 s | details |
#24 | ACCEPTED | 0.00 s | details |
#25 | ACCEPTED | 0.00 s | details |
#26 | ACCEPTED | 0.00 s | details |
#27 | ACCEPTED | 0.00 s | details |
#28 | ACCEPTED | 0.00 s | details |
#29 | ACCEPTED | 0.00 s | details |
#30 | ACCEPTED | 0.00 s | details |
#31 | ACCEPTED | 0.00 s | details |
#32 | ACCEPTED | 0.00 s | details |
#33 | ACCEPTED | 0.00 s | details |
#34 | ACCEPTED | 0.00 s | details |
#35 | ACCEPTED | 0.01 s | details |
#36 | ACCEPTED | 0.01 s | details |
#37 | ACCEPTED | 0.00 s | details |
#38 | ACCEPTED | 0.00 s | details |
#39 | ACCEPTED | 0.00 s | details |
#40 | ACCEPTED | 0.00 s | details |
#41 | ACCEPTED | 0.00 s | details |
#42 | ACCEPTED | 0.00 s | details |
#43 | ACCEPTED | 0.00 s | details |
#44 | ACCEPTED | 0.00 s | details |
#45 | ACCEPTED | 0.00 s | details |
#46 | ACCEPTED | 0.00 s | details |
#47 | ACCEPTED | 0.00 s | details |
#48 | ACCEPTED | 0.00 s | details |
#49 | ACCEPTED | 0.01 s | details |
#50 | ACCEPTED | 0.01 s | details |
#51 | ACCEPTED | 0.76 s | details |
#52 | ACCEPTED | 0.12 s | details |
#53 | ACCEPTED | 0.18 s | details |
#54 | ACCEPTED | 0.78 s | details |
#55 | ACCEPTED | 0.12 s | details |
#56 | ACCEPTED | 0.57 s | details |
#57 | ACCEPTED | 0.12 s | details |
#58 | ACCEPTED | 0.59 s | details |
#59 | ACCEPTED | 0.96 s | details |
#60 | ACCEPTED | 0.64 s | details |
#61 | TIME LIMIT EXCEEDED | -- | details |
#62 | TIME LIMIT EXCEEDED | -- | details |
#63 | TIME LIMIT EXCEEDED | -- | details |
#64 | TIME LIMIT EXCEEDED | -- | details |
#65 | TIME LIMIT EXCEEDED | -- | details |
#66 | TIME LIMIT EXCEEDED | -- | details |
#67 | TIME LIMIT EXCEEDED | -- | details |
#68 | TIME LIMIT EXCEEDED | -- | details |
#69 | TIME LIMIT EXCEEDED | -- | details |
#70 | TIME LIMIT EXCEEDED | -- | details |
#71 | TIME LIMIT EXCEEDED | -- | details |
#72 | TIME LIMIT EXCEEDED | -- | details |
#73 | TIME LIMIT EXCEEDED | -- | details |
#74 | TIME LIMIT EXCEEDED | -- | details |
#75 | TIME LIMIT EXCEEDED | -- | details |
#76 | TIME LIMIT EXCEEDED | -- | details |
#77 | TIME LIMIT EXCEEDED | -- | details |
#78 | TIME LIMIT EXCEEDED | -- | details |
#79 | TIME LIMIT EXCEEDED | -- | details |
#80 | TIME LIMIT EXCEEDED | -- | details |
Code
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; ll val(ll A, ll B){ return A*A*B + B*B*A; } ll dA(ll A, ll B){ return 2*B*A+B*B; } ll dB(ll A, ll B){ return 2*B*A+A*A; } int main(){ ios::sync_with_stdio(0); cin.tie(0); ull N; cin >> N; if(N == 0){ cout << "0 0\n"; return 0; } ull bA=0, bB=0; ll bS=(unsigned)(-1); ll a = 1; bool anygood = true; while(exchange(anygood, false)){ anygood = false; for(ll b=1; b<=a; b++){ // cout << "this: " << a << " " << b << "\n"; ll v = val(a, b); ll e = N - v; // cout << a << " " << b << " " << e << "\n"; if(e >= 0 && e < bS){ bA = a; bB = b; bS = e; } anygood |= (e >= 0); } a ++; } cout << bA << " " << bB << "\n"; // cout << bA << " " << bB << " " << val(bA, bB) << endl; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
8 |
correct output |
---|
2 1 |
user output |
---|
2 1 |
Test 2
Verdict: ACCEPTED
input |
---|
7 |
correct output |
---|
2 1 |
user output |
---|
2 1 |
Test 3
Verdict: ACCEPTED
input |
---|
46 |
correct output |
---|
6 1 |
user output |
---|
6 1 |
Test 4
Verdict: ACCEPTED
input |
---|
28 |
correct output |
---|
4 1 |
user output |
---|
4 1 |
Test 5
Verdict: ACCEPTED
input |
---|
40 |
correct output |
---|
5 1 |
user output |
---|
3 2 |
Test 6
Verdict: ACCEPTED
input |
---|
34 |
correct output |
---|
5 1 |
user output |
---|
3 2 |
Test 7
Verdict: ACCEPTED
input |
---|
39 |
correct output |
---|
5 1 |
user output |
---|
3 2 |
Test 8
Verdict: ACCEPTED
input |
---|
38 |
correct output |
---|
5 1 |
user output |
---|
3 2 |
Test 9
Verdict: ACCEPTED
input |
---|
25 |
correct output |
---|
4 1 |
user output |
---|
4 1 |
Test 10
Verdict: ACCEPTED
input |
---|
26 |
correct output |
---|
4 1 |
user output |
---|
4 1 |
Test 11
Verdict: ACCEPTED
input |
---|
549 |
correct output |
---|
7 6 |
user output |
---|
7 6 |
Test 12
Verdict: ACCEPTED
input |
---|
418 |
correct output |
---|
13 2 |
user output |
---|
10 3 |
Test 13
Verdict: ACCEPTED
input |
---|
436 |
correct output |
---|
6 6 |
user output |
---|
6 6 |
Test 14
Verdict: ACCEPTED
input |
---|
551 |
correct output |
---|
7 6 |
user output |
---|
7 6 |
Test 15
Verdict: ACCEPTED
input |
---|
968 |
correct output |
---|
21 2 |
user output |
---|
21 2 |
Test 16
Verdict: ACCEPTED
input |
---|
222 |
correct output |
---|
14 1 |
user output |
---|
7 3 |
Test 17
Verdict: ACCEPTED
input |
---|
893 |
correct output |
---|
13 4 |
user output |
---|
13 4 |
Test 18
Verdict: ACCEPTED
input |
---|
77 |
correct output |
---|
8 1 |
user output |
---|
8 1 |
Test 19
Verdict: ACCEPTED
input |
---|
874 |
correct output |
---|
29 1 |
user output |
---|
29 1 |
Test 20
Verdict: ACCEPTED
input |
---|
11 |
correct output |
---|
2 1 |
user output |
---|
2 1 |
Test 21
Verdict: ACCEPTED
input |
---|
772 |
correct output |
---|
12 4 |
user output |
---|
12 4 |
Test 22
Verdict: ACCEPTED
input |
---|
181 |
correct output |
---|
5 4 |
user output |
---|
5 4 |
Test 23
Verdict: ACCEPTED
input |
---|
155 |
correct output |
---|
11 1 |
user output |
---|
11 1 |
Test 24
Verdict: ACCEPTED
input |
---|
778 |
correct output |
---|
12 4 |
user output |
---|
12 4 |
Test 25
Verdict: ACCEPTED
input |
---|
514 |
correct output |
---|
15 2 |
user output |
---|
15 2 |
Test 26
Verdict: ACCEPTED
input |
---|
849 |
correct output |
---|
8 7 |
user output |
---|
8 7 |
Test 27
Verdict: ACCEPTED
input |
---|
224 |
correct output |
---|
14 1 |
user output |
---|
7 3 |
Test 28
Verdict: ACCEPTED
input |
---|
295 |
correct output |
---|
11 2 |
user output |
---|
11 2 |
Test 29
Verdict: ACCEPTED
input |
---|
651 |
correct output |
---|
25 1 |
user output |
---|
25 1 |
Test 30
Verdict: ACCEPTED
input |
---|
98 |
correct output |
---|
6 2 |
user output |
---|
6 2 |
Test 31
Verdict: ACCEPTED
input |
---|
588264 |
correct output |
---|
172 18 |
user output |
---|
172 18 |
Test 32
Verdict: ACCEPTED
input |
---|
48736 |
correct output |
---|
80 7 |
user output |
---|
30 28 |
Test 33
Verdict: ACCEPTED
input |
---|
208508 |
correct output |
---|
99 18 |
user output |
---|
99 18 |
Test 34
Verdict: ACCEPTED
input |
---|
517415 |
correct output |
---|
172 16 |
user output |
---|
172 16 |
Test 35
Verdict: ACCEPTED
input |
---|
960234 |
correct output |
---|
290 11 |
user output |
---|
290 11 |
Test 36
Verdict: ACCEPTED
input |
---|
870321 |
correct output |
---|
111 49 |
user output |
---|
111 49 |
Test 37
Verdict: ACCEPTED
input |
---|
308005 |
correct output |
---|
70 40 |
user output |
---|
70 40 |
Test 38
Verdict: ACCEPTED
input |
---|
425818 |
correct output |
---|
652 1 |
user output |
---|
652 1 |
Test 39
Verdict: ACCEPTED
input |
---|
729178 |
correct output |
---|
83 61 |
user output |
---|
83 61 |
Test 40
Verdict: ACCEPTED
input |
---|
863955 |
correct output |
---|
535 3 |
user output |
---|
535 3 |
Test 41
Verdict: ACCEPTED
input |
---|
116086 |
correct output |
---|
340 1 |
user output |
---|
340 1 |
Test 42
Verdict: ACCEPTED
input |
---|
612309 |
correct output |
---|
782 1 |
user output |
---|
87 51 |
Test 43
Verdict: ACCEPTED
input |
---|
375142 |
correct output |
---|
228 7 |
user output |
---|
228 7 |
Test 44
Verdict: ACCEPTED
input |
---|
852178 |
correct output |
---|
161 28 |
user output |
---|
161 28 |
Test 45
Verdict: ACCEPTED
input |
---|
151667 |
correct output |
---|
156 6 |
user output |
---|
156 6 |
Test 46
Verdict: ACCEPTED
input |
---|
196137 |
correct output |
---|
103 16 |
user output |
---|
103 16 |
Test 47
Verdict: ACCEPTED
input |
---|
375254 |
correct output |
---|
612 1 |
user output |
---|
612 1 |
Test 48
Verdict: ACCEPTED
input |
---|
451513 |
correct output |
---|
298 5 |
user output |
---|
298 5 |
Test 49
Verdict: ACCEPTED
input |
---|
942864 |
correct output |
---|
122 46 |
user output |
---|
122 46 |
Test 50
Verdict: ACCEPTED
input |
---|
848035 |
correct output |
---|
215 17 |
user output |
---|
215 17 |
Test 51
Verdict: ACCEPTED
input |
---|
727949226 |
correct output |
---|
1876 188 |
user output |
---|
1876 188 |
Test 52
Verdict: ACCEPTED
input |
---|
119540561 |
correct output |
---|
395 387 |
user output |
---|
395 387 |
Test 53
Verdict: ACCEPTED
input |
---|
168568700 |
correct output |
---|
447 430 |
user output |
---|
447 430 |
Test 54
Verdict: ACCEPTED
input |
---|
747828096 |
correct output |
---|
2098 158 |
user output |
---|
2098 158 |
Test 55
Verdict: ACCEPTED
input |
---|
113886324 |
correct output |
---|
949 113 |
user output |
---|
949 113 |
Test 56
Verdict: ACCEPTED
input |
---|
544092912 |
correct output |
---|
2620 77 |
user output |
---|
2620 77 |
Test 57
Verdict: ACCEPTED
input |
---|
112927706 |
correct output |
---|
532 266 |
user output |
---|
532 266 |
Test 58
Verdict: ACCEPTED
input |
---|
562461747 |
correct output |
---|
1803 159 |
user output |
---|
1803 159 |
Test 59
Verdict: ACCEPTED
input |
---|
930544437 |
correct output |
---|
7390 17 |
user output |
---|
7390 17 |
Test 60
Verdict: ACCEPTED
input |
---|
612603672 |
correct output |
---|
1128 364 |
user output |
---|
1128 364 |
Test 61
Verdict: TIME LIMIT EXCEEDED
input |
---|
575864416073 |
correct output |
---|
7427 5843 |
user output |
---|
(empty) |
Test 62
Verdict: TIME LIMIT EXCEEDED
input |
---|
942935707814 |
correct output |
---|
63092 236 |
user output |
---|
(empty) |
Test 63
Verdict: TIME LIMIT EXCEEDED
input |
---|
171264013251 |
correct output |
---|
14433 780 |
user output |
---|
(empty) |
Test 64
Verdict: TIME LIMIT EXCEEDED
input |
---|
76712165827 |
correct output |
---|
8381 978 |
user output |
---|
(empty) |
Test 65
Verdict: TIME LIMIT EXCEEDED
input |
---|
161612205399 |
correct output |
---|
7527 2206 |
user output |
---|
(empty) |
Test 66
Verdict: TIME LIMIT EXCEEDED
input |
---|
641183113758 |
correct output |
---|
50116 254 |
user output |
---|
(empty) |
Test 67
Verdict: TIME LIMIT EXCEEDED
input |
---|
87822361843 |
correct output |
---|
24538 145 |
user output |
---|
(empty) |
Test 68
Verdict: TIME LIMIT EXCEEDED
input |
---|
550401843854 |
correct output |
---|
14093 2372 |
user output |
---|
(empty) |
Test 69
Verdict: TIME LIMIT EXCEEDED
input |
---|
56603972680 |
correct output |
---|
10404 499 |
user output |
---|
(empty) |
Test 70
Verdict: TIME LIMIT EXCEEDED
input |
---|
991404337870 |
correct output |
---|
109250 83 |
user output |
---|
(empty) |
Test 71
Verdict: TIME LIMIT EXCEEDED
input |
---|
534149659344 |
correct output |
---|
53496 186 |
user output |
---|
(empty) |
Test 72
Verdict: TIME LIMIT EXCEEDED
input |
---|
336010906011 |
correct output |
---|
183301 10 |
user output |
---|
(empty) |
Test 73
Verdict: TIME LIMIT EXCEEDED
input |
---|
871714540470 |
correct output |
---|
214186 19 |
user output |
---|
(empty) |
Test 74
Verdict: TIME LIMIT EXCEEDED
input |
---|
254659717917 |
correct output |
---|
17240 818 |
user output |
---|
(empty) |
Test 75
Verdict: TIME LIMIT EXCEEDED
input |
---|
40507166127 |
correct output |
---|
3335 2196 |
user output |
---|
(empty) |
Test 76
Verdict: TIME LIMIT EXCEEDED
input |
---|
445628406612 |
correct output |
---|
23039 811 |
user output |
---|
(empty) |
Test 77
Verdict: TIME LIMIT EXCEEDED
input |
---|
822717753419 |
correct output |
---|
39363 524 |
user output |
---|
(empty) |
Test 78
Verdict: TIME LIMIT EXCEEDED
input |
---|
40410210216 |
correct output |
---|
10096 382 |
user output |
---|
(empty) |
Test 79
Verdict: TIME LIMIT EXCEEDED
input |
---|
366117794932 |
correct output |
---|
49165 151 |
user output |
---|
(empty) |
Test 80
Verdict: TIME LIMIT EXCEEDED
input |
---|
657992849714 |
correct output |
---|
11698 3662 |
user output |
---|
(empty) |