Task: | Gas tank |
Sender: | aalto2024k_003 |
Submission time: | 2024-11-13 17:21:16 +0200 |
Language: | C++ (C++20) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.21 s | details |
#2 | ACCEPTED | 0.21 s | details |
#3 | ACCEPTED | 0.21 s | details |
#4 | ACCEPTED | 0.21 s | details |
#5 | ACCEPTED | 0.21 s | details |
#6 | ACCEPTED | 0.21 s | details |
#7 | ACCEPTED | 0.21 s | details |
#8 | ACCEPTED | 0.21 s | details |
#9 | ACCEPTED | 0.21 s | details |
#10 | ACCEPTED | 0.21 s | details |
#11 | ACCEPTED | 0.22 s | details |
#12 | ACCEPTED | 0.21 s | details |
#13 | ACCEPTED | 0.21 s | details |
#14 | ACCEPTED | 0.21 s | details |
#15 | ACCEPTED | 0.21 s | details |
#16 | ACCEPTED | 0.22 s | details |
#17 | ACCEPTED | 0.21 s | details |
#18 | ACCEPTED | 0.21 s | details |
#19 | ACCEPTED | 0.22 s | details |
#20 | ACCEPTED | 0.22 s | details |
#21 | ACCEPTED | 0.22 s | details |
#22 | ACCEPTED | 0.21 s | details |
#23 | ACCEPTED | 0.21 s | details |
#24 | ACCEPTED | 0.22 s | details |
#25 | ACCEPTED | 0.22 s | details |
#26 | ACCEPTED | 0.22 s | details |
#27 | ACCEPTED | 0.22 s | details |
#28 | ACCEPTED | 0.22 s | details |
#29 | ACCEPTED | 0.21 s | details |
#30 | ACCEPTED | 0.21 s | details |
#31 | ACCEPTED | 0.22 s | details |
#32 | ACCEPTED | 0.21 s | details |
#33 | ACCEPTED | 0.22 s | details |
#34 | ACCEPTED | 0.21 s | details |
#35 | ACCEPTED | 0.21 s | details |
#36 | ACCEPTED | 0.22 s | details |
#37 | ACCEPTED | 0.21 s | details |
#38 | ACCEPTED | 0.21 s | details |
#39 | ACCEPTED | 0.22 s | details |
#40 | ACCEPTED | 0.21 s | details |
#41 | ACCEPTED | 0.21 s | details |
#42 | ACCEPTED | 0.22 s | details |
#43 | ACCEPTED | 0.22 s | details |
#44 | ACCEPTED | 0.22 s | details |
#45 | ACCEPTED | 0.22 s | details |
#46 | ACCEPTED | 0.21 s | details |
#47 | ACCEPTED | 0.22 s | details |
#48 | ACCEPTED | 0.21 s | details |
#49 | ACCEPTED | 0.21 s | details |
#50 | ACCEPTED | 0.21 s | details |
#51 | ACCEPTED | 0.22 s | details |
#52 | ACCEPTED | 0.21 s | details |
#53 | ACCEPTED | 0.22 s | details |
#54 | ACCEPTED | 0.22 s | details |
#55 | ACCEPTED | 0.22 s | details |
#56 | ACCEPTED | 0.22 s | details |
#57 | ACCEPTED | 0.22 s | details |
#58 | ACCEPTED | 0.22 s | details |
#59 | ACCEPTED | 0.22 s | details |
#60 | ACCEPTED | 0.22 s | details |
#61 | ACCEPTED | 0.28 s | details |
#62 | WRONG ANSWER | 0.29 s | details |
#63 | WRONG ANSWER | 0.26 s | details |
#64 | ACCEPTED | 0.24 s | details |
#65 | ACCEPTED | 0.25 s | details |
#66 | WRONG ANSWER | 0.29 s | details |
#67 | WRONG ANSWER | 0.25 s | details |
#68 | WRONG ANSWER | 0.28 s | details |
#69 | WRONG ANSWER | 0.24 s | details |
#70 | WRONG ANSWER | 0.29 s | details |
#71 | WRONG ANSWER | 0.28 s | details |
#72 | WRONG ANSWER | 0.28 s | details |
#73 | WRONG ANSWER | 0.30 s | details |
#74 | WRONG ANSWER | 0.26 s | details |
#75 | ACCEPTED | 0.24 s | details |
#76 | WRONG ANSWER | 0.28 s | details |
#77 | WRONG ANSWER | 0.29 s | details |
#78 | WRONG ANSWER | 0.24 s | details |
#79 | WRONG ANSWER | 0.27 s | details |
#80 | WRONG ANSWER | 0.28 s | details |
Code
#include <bits/stdc++.h> #include <iomanip> #include <vector> using namespace std; #define int long long #define rep(i, a, b) for(int i = a; i < (b); ++i) #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; typedef long double ld; string to_string(string s) { return '"' + s + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(bool b) { return (b ? "true" : "false"); } template <typename A, typename B> string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; } template <typename A> string to_string(A v) { bool first = true; string res = "{"; for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); } res += "}"; return res; } void debug_out() { cerr << endl; } template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...); } #ifdef LOCAL #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__) #else #define debug(...) 42 #endif /** * Author: Ulf Lundstrom * Date: 2009-02-26 * License: CC0 * Source: My head with inspiration from tinyKACTL * Description: Class to handle points in the plane. * T can be e.g. double or long long. (Avoid int.) * Status: Works fine, used a lot */ template <class T> int sgn(T x) { return (x > 0) - (x < 0); } template<class T> struct Point { typedef Point P; T x, y; explicit Point(T x=0, T y=0) : x(x), y(y) {} bool operator<(P p) const { return tie(x,y) < tie(p.x,p.y); } bool operator==(P p) const { return tie(x,y)==tie(p.x,p.y); } P operator+(P p) const { return P(x+p.x, y+p.y); } P operator-(P p) const { return P(x-p.x, y-p.y); } P operator*(T d) const { return P(x*d, y*d); } P operator/(T d) const { return P(x/d, y/d); } T dot(P p) const { return x*p.x + y*p.y; } T cross(P p) const { return x*p.y - y*p.x; } T cross(P a, P b) const { return (a-*this).cross(b-*this); } T dist2() const { return x*x + y*y; } double dist() const { return sqrt((double)dist2()); } // angle to x-axis in interval [-pi, pi] double angle() const { return atan2(y, x); } P unit() const { return *this/dist(); } // makes dist()=1 P perp() const { return P(-y, x); } // rotates +90 degrees P normal() const { return perp().unit(); } // returns point rotated 'a' radians ccw around the origin P rotate(double a) const { return P(x*cos(a)-y*sin(a),x*sin(a)+y*cos(a)); } friend ostream& operator<<(ostream& os, P p) { return os << "(" << p.x << "," << p.y << ")"; } }; const int N = 10; signed main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); // RTE if input wrong datatype int n; cin >> n; int best = 0; int besta = 0; int bestb = 0; for (int a = 1; a <= 10000; a++) { for (int b = 1; b <= 10000; b++) { int v = a * a * b + b * b * a; if (v <= n && v > best) { best = v; besta = a; bestb = b; } } } cout << besta << ' ' << bestb; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
8 |
correct output |
---|
2 1 |
user output |
---|
1 2 |
Test 2
Verdict: ACCEPTED
input |
---|
7 |
correct output |
---|
2 1 |
user output |
---|
1 2 |
Test 3
Verdict: ACCEPTED
input |
---|
46 |
correct output |
---|
6 1 |
user output |
---|
1 6 |
Test 4
Verdict: ACCEPTED
input |
---|
28 |
correct output |
---|
4 1 |
user output |
---|
1 4 |
Test 5
Verdict: ACCEPTED
input |
---|
40 |
correct output |
---|
5 1 |
user output |
---|
1 5 |
Test 6
Verdict: ACCEPTED
input |
---|
34 |
correct output |
---|
5 1 |
user output |
---|
1 5 |
Test 7
Verdict: ACCEPTED
input |
---|
39 |
correct output |
---|
5 1 |
user output |
---|
1 5 |
Test 8
Verdict: ACCEPTED
input |
---|
38 |
correct output |
---|
5 1 |
user output |
---|
1 5 |
Test 9
Verdict: ACCEPTED
input |
---|
25 |
correct output |
---|
4 1 |
user output |
---|
1 4 |
Test 10
Verdict: ACCEPTED
input |
---|
26 |
correct output |
---|
4 1 |
user output |
---|
1 4 |
Test 11
Verdict: ACCEPTED
input |
---|
549 |
correct output |
---|
7 6 |
user output |
---|
6 7 |
Test 12
Verdict: ACCEPTED
input |
---|
418 |
correct output |
---|
13 2 |
user output |
---|
2 13 |
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 |
---|
6 7 |
Test 15
Verdict: ACCEPTED
input |
---|
968 |
correct output |
---|
21 2 |
user output |
---|
2 21 |
Test 16
Verdict: ACCEPTED
input |
---|
222 |
correct output |
---|
14 1 |
user output |
---|
1 14 |
Test 17
Verdict: ACCEPTED
input |
---|
893 |
correct output |
---|
13 4 |
user output |
---|
4 13 |
Test 18
Verdict: ACCEPTED
input |
---|
77 |
correct output |
---|
8 1 |
user output |
---|
1 8 |
Test 19
Verdict: ACCEPTED
input |
---|
874 |
correct output |
---|
29 1 |
user output |
---|
1 29 |
Test 20
Verdict: ACCEPTED
input |
---|
11 |
correct output |
---|
2 1 |
user output |
---|
1 2 |
Test 21
Verdict: ACCEPTED
input |
---|
772 |
correct output |
---|
12 4 |
user output |
---|
4 12 |
Test 22
Verdict: ACCEPTED
input |
---|
181 |
correct output |
---|
5 4 |
user output |
---|
4 5 |
Test 23
Verdict: ACCEPTED
input |
---|
155 |
correct output |
---|
11 1 |
user output |
---|
1 11 |
Test 24
Verdict: ACCEPTED
input |
---|
778 |
correct output |
---|
12 4 |
user output |
---|
4 12 |
Test 25
Verdict: ACCEPTED
input |
---|
514 |
correct output |
---|
15 2 |
user output |
---|
2 15 |
Test 26
Verdict: ACCEPTED
input |
---|
849 |
correct output |
---|
8 7 |
user output |
---|
7 8 |
Test 27
Verdict: ACCEPTED
input |
---|
224 |
correct output |
---|
14 1 |
user output |
---|
1 14 |
Test 28
Verdict: ACCEPTED
input |
---|
295 |
correct output |
---|
11 2 |
user output |
---|
2 11 |
Test 29
Verdict: ACCEPTED
input |
---|
651 |
correct output |
---|
25 1 |
user output |
---|
1 25 |
Test 30
Verdict: ACCEPTED
input |
---|
98 |
correct output |
---|
6 2 |
user output |
---|
2 6 |
Test 31
Verdict: ACCEPTED
input |
---|
588264 |
correct output |
---|
172 18 |
user output |
---|
18 172 |
Test 32
Verdict: ACCEPTED
input |
---|
48736 |
correct output |
---|
80 7 |
user output |
---|
7 80 |
Test 33
Verdict: ACCEPTED
input |
---|
208508 |
correct output |
---|
99 18 |
user output |
---|
18 99 |
Test 34
Verdict: ACCEPTED
input |
---|
517415 |
correct output |
---|
172 16 |
user output |
---|
16 172 |
Test 35
Verdict: ACCEPTED
input |
---|
960234 |
correct output |
---|
290 11 |
user output |
---|
11 290 |
Test 36
Verdict: ACCEPTED
input |
---|
870321 |
correct output |
---|
111 49 |
user output |
---|
49 111 |
Test 37
Verdict: ACCEPTED
input |
---|
308005 |
correct output |
---|
70 40 |
user output |
---|
40 70 |
Test 38
Verdict: ACCEPTED
input |
---|
425818 |
correct output |
---|
652 1 |
user output |
---|
1 652 |
Test 39
Verdict: ACCEPTED
input |
---|
729178 |
correct output |
---|
83 61 |
user output |
---|
61 83 |
Test 40
Verdict: ACCEPTED
input |
---|
863955 |
correct output |
---|
535 3 |
user output |
---|
3 535 |
Test 41
Verdict: ACCEPTED
input |
---|
116086 |
correct output |
---|
340 1 |
user output |
---|
1 340 |
Test 42
Verdict: ACCEPTED
input |
---|
612309 |
correct output |
---|
782 1 |
user output |
---|
1 782 |
Test 43
Verdict: ACCEPTED
input |
---|
375142 |
correct output |
---|
228 7 |
user output |
---|
7 228 |
Test 44
Verdict: ACCEPTED
input |
---|
852178 |
correct output |
---|
161 28 |
user output |
---|
28 161 |
Test 45
Verdict: ACCEPTED
input |
---|
151667 |
correct output |
---|
156 6 |
user output |
---|
6 156 |
Test 46
Verdict: ACCEPTED
input |
---|
196137 |
correct output |
---|
103 16 |
user output |
---|
16 103 |
Test 47
Verdict: ACCEPTED
input |
---|
375254 |
correct output |
---|
612 1 |
user output |
---|
1 612 |
Test 48
Verdict: ACCEPTED
input |
---|
451513 |
correct output |
---|
298 5 |
user output |
---|
5 298 |
Test 49
Verdict: ACCEPTED
input |
---|
942864 |
correct output |
---|
122 46 |
user output |
---|
46 122 |
Test 50
Verdict: ACCEPTED
input |
---|
848035 |
correct output |
---|
215 17 |
user output |
---|
17 215 |
Test 51
Verdict: ACCEPTED
input |
---|
727949226 |
correct output |
---|
1876 188 |
user output |
---|
188 1876 |
Test 52
Verdict: ACCEPTED
input |
---|
119540561 |
correct output |
---|
395 387 |
user output |
---|
387 395 |
Test 53
Verdict: ACCEPTED
input |
---|
168568700 |
correct output |
---|
447 430 |
user output |
---|
430 447 |
Test 54
Verdict: ACCEPTED
input |
---|
747828096 |
correct output |
---|
2098 158 |
user output |
---|
158 2098 |
Test 55
Verdict: ACCEPTED
input |
---|
113886324 |
correct output |
---|
949 113 |
user output |
---|
113 949 |
Test 56
Verdict: ACCEPTED
input |
---|
544092912 |
correct output |
---|
2620 77 |
user output |
---|
77 2620 |
Test 57
Verdict: ACCEPTED
input |
---|
112927706 |
correct output |
---|
532 266 |
user output |
---|
266 532 |
Test 58
Verdict: ACCEPTED
input |
---|
562461747 |
correct output |
---|
1803 159 |
user output |
---|
159 1803 |
Test 59
Verdict: ACCEPTED
input |
---|
930544437 |
correct output |
---|
7390 17 |
user output |
---|
17 7390 |
Test 60
Verdict: ACCEPTED
input |
---|
612603672 |
correct output |
---|
1128 364 |
user output |
---|
364 1128 |
Test 61
Verdict: ACCEPTED
input |
---|
575864416073 |
correct output |
---|
7427 5843 |
user output |
---|
5843 7427 |
Test 62
Verdict: WRONG ANSWER
input |
---|
942935707814 |
correct output |
---|
63092 236 |
user output |
---|
6075 9786 |
Test 63
Verdict: WRONG ANSWER
input |
---|
171264013251 |
correct output |
---|
14433 780 |
user output |
---|
2101 8039 |
Test 64
Verdict: ACCEPTED
input |
---|
76712165827 |
correct output |
---|
8381 978 |
user output |
---|
978 8381 |
Test 65
Verdict: ACCEPTED
input |
---|
161612205399 |
correct output |
---|
7527 2206 |
user output |
---|
2206 7527 |
Test 66
Verdict: WRONG ANSWER
input |
---|
641183113758 |
correct output |
---|
50116 254 |
user output |
---|
4848 9329 |
Test 67
Verdict: WRONG ANSWER
input |
---|
87822361843 |
correct output |
---|
24538 145 |
user output |
---|
2863 4289 |
Test 68
Verdict: WRONG ANSWER
input |
---|
550401843854 |
correct output |
---|
14093 2372 |
user output |
---|
5499 7626 |
Test 69
Verdict: WRONG ANSWER
input |
---|
56603972680 |
correct output |
---|
10404 499 |
user output |
---|
1477 5496 |
Test 70
Verdict: WRONG ANSWER
input |
---|
991404337870 |
correct output |
---|
109250 83 |
user output |
---|
7777 8053 |
Test 71
Verdict: WRONG ANSWER
input |
---|
534149659344 |
correct output |
---|
53496 186 |
user output |
---|
3915 9886 |
Test 72
Verdict: WRONG ANSWER
input |
---|
336010906011 |
correct output |
---|
183301 10 |
user output |
---|
5160 5892 |
Test 73
Verdict: WRONG ANSWER
input |
---|
871714540470 |
correct output |
---|
214186 19 |
user output |
---|
6546 8722 |
Test 74
Verdict: WRONG ANSWER
input |
---|
254659717917 |
correct output |
---|
17240 818 |
user output |
---|
4591 5498 |
Test 75
Verdict: ACCEPTED
input |
---|
40507166127 |
correct output |
---|
3335 2196 |
user output |
---|
2196 3335 |
Test 76
Verdict: WRONG ANSWER
input |
---|
445628406612 |
correct output |
---|
23039 811 |
user output |
---|
4825 7496 |
Test 77
Verdict: WRONG ANSWER
input |
---|
822717753419 |
correct output |
---|
39363 524 |
user output |
---|
6125 8925 |
Test 78
Verdict: WRONG ANSWER
input |
---|
40410210216 |
correct output |
---|
10096 382 |
user output |
---|
1079 5604 |
Test 79
Verdict: WRONG ANSWER
input |
---|
366117794932 |
correct output |
---|
49165 151 |
user output |
---|
5180 6207 |
Test 80
Verdict: WRONG ANSWER
input |
---|
657992849714 |
correct output |
---|
11698 3662 |
user output |
---|
6271 7577 |