Task: | Entrepreneur |
Sender: | aalto2024a_012 |
Submission time: | 2024-09-04 16:57:16 +0300 |
Language: | C++ (C++11) |
Status: | READY |
Result: | WRONG ANSWER |
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 | WRONG ANSWER | 0.15 s | details |
#9 | ACCEPTED | 0.17 s | details |
#10 | ACCEPTED | 0.17 s | details |
#11 | WRONG ANSWER | 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 |
Code
#include <bits/stdc++.h> using namespace std; #define int long long 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 const int N = 2e5 + 5; int n, t, k[N]; signed main() { cin.tie(0)->sync_with_stdio(0); cin >> n >> t; for (int i = 1; i <= n; i++) { cin >> k[i]; } int low = 0, high = 1e18, ans = 0; while (low <= high) { int mid = low + (high - low) / 2; int cnt = 0; for (int i = 1; i <= n; i++) { cnt += mid / k[i]; } if (cnt >= t) { ans = mid; high = mid - 1; } else { low = mid + 1; } } cout << ans << '\n'; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
10 10 6 5 1 2 1 5 10 4 6 6 |
correct output |
---|
4 |
user output |
---|
4 |
Test 2
Verdict: ACCEPTED
input |
---|
10 10 6 6 4 3 4 9 3 2 6 10 |
correct output |
---|
6 |
user output |
---|
6 |
Test 3
Verdict: ACCEPTED
input |
---|
10 10 5 4 10 7 8 4 1 8 9 2 |
correct output |
---|
5 |
user output |
---|
5 |
Test 4
Verdict: ACCEPTED
input |
---|
1 1000000000 1 |
correct output |
---|
1000000000 |
user output |
---|
1000000000 |
Test 5
Verdict: ACCEPTED
input |
---|
1 1000000000 1000000000 |
correct output |
---|
1000000000000000000 |
user output |
---|
1000000000000000000 |
Test 6
Verdict: ACCEPTED
input |
---|
1000 1000 271 687 392 992 11 410 702 870... |
correct output |
---|
223 |
user output |
---|
223 |
Test 7
Verdict: ACCEPTED
input |
---|
1000 1000 598 523 703 794 737 689 724 26... |
correct output |
---|
282 |
user output |
---|
282 |
Test 8
Verdict: WRONG ANSWER
input |
---|
200000 1000000000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
5000 |
user output |
---|
432022746206282699 |
Test 9
Verdict: ACCEPTED
input |
---|
200000 1 760045594 599341056 300698860 ... |
correct output |
---|
8214 |
user output |
---|
8214 |
Test 10
Verdict: ACCEPTED
input |
---|
200000 1000000000 33941840 210038922 596070148 7... |
correct output |
---|
371045814100 |
user output |
---|
371045814100 |
Test 11
Verdict: WRONG ANSWER
input |
---|
25 1000000000 1000000000 1 1 1 1 1 1 1 1 1 1... |
correct output |
---|
41666667 |
user output |
---|
768614336414205720 |
Test 12
Verdict: ACCEPTED
input |
---|
12 1000000000 1 1 1 1 1 1 1 1 1 1 1 10000000... |
correct output |
---|
90909091 |
user output |
---|
90909091 |
Test 13
Verdict: ACCEPTED
input |
---|
23 1000000000 1000000000 1000000000 10000000... |
correct output |
---|
43478261000000000 |
user output |
---|
43478261000000000 |
Test 14
Verdict: ACCEPTED
input |
---|
23 1000000000 1000000000 1000000000 10000000... |
correct output |
---|
43478261000000000 |
user output |
---|
43478261000000000 |
Test 15
Verdict: ACCEPTED
input |
---|
3 3 10 11 12 |
correct output |
---|
12 |
user output |
---|
12 |