| Task: | Entrepreneur |
| Sender: | datxaban |
| Submission time: | 2025-09-03 17:23:05 +0300 |
| Language: | C++ (C++17) |
| 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 | ACCEPTED | 0.09 s | details |
| #9 | ACCEPTED | 0.10 s | details |
| #10 | ACCEPTED | 0.16 s | details |
| #11 | WRONG ANSWER | 0.00 s | details |
| #12 | ACCEPTED | 0.00 s | details |
| #13 | ACCEPTED | 0.00 s | details |
| #14 | ACCEPTED | 0.01 s | details |
| #15 | ACCEPTED | 0.00 s | details |
Code
/*
Road to Freedom
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define F first
#define S second
#define pb push_back
#define si set <int>
#define vi vector <int>
#define pii pair <int, int>
#define vpi vector <pii>
#define vpp vector <pair<int, pii>>
#define mii map <int, int>
#define mpi map <pii, int>
#define spi set <pii>
#define endl "\n"
#define sz(x) ((int) x.size())
#define all(p) p.begin(), p.end()
#define double long double
#define que_max priority_queue <int>
#define que_min priority_queue <int, vi, greater<int>>
#define bug(...) __f (#__VA_ARGS__, __VA_ARGS__)
#define print(a) for(auto x : a) cout << x << " ";
#define print1(a) for(auto x : a) cout << x.F << " " << x.S << endl
#define print2(a,x,y) for(int i = x; i < y; i++) cout<< a[i]<< " "; cout << endl
#define REP(i,a,b) for (int i = a; i <= b; i++)
inline int power(int a, int b)
{
int x = 1;
while (b)
{
if (b & 1) x *= a;
a *= a;
b >>= 1;
}
return x;
}
template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{
const char* comma = strchr (names + 1, ',');
cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}
bool check(ll hour, vector<int>& machine, ll car){
ll prod = 0;
for(auto& x:machine){
prod += hour/x;
}
if(prod >= car) return true;
return false;
}
void solve(){
ll n, t; cin >> n >> t; // machine and car
vector<int> machine(n);
for(int i = 0; i < n ;i++){
cin >> machine[i];
}
//bin search
ll left = 1;
ll right = machine[0]*t;
while (left <= right) {
ll mid = left + (right - left) / 2;
if (check(mid, machine, t)) {
right = mid - 1;
} else {
left = mid + 1;
}
}
cout << left;
}
int32_t main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
clock_t z = clock();
int t = 1;
// cin >> t;
while (t--) solve();
cerr << "Run Time : " << ((double)(clock() - z) / CLOCKS_PER_SEC);
return 0;
}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 |
Error:
Run Time : 3.9e-05
Test 2
Verdict: ACCEPTED
| input |
|---|
| 10 10 6 6 4 3 4 9 3 2 6 10 |
| correct output |
|---|
| 6 |
| user output |
|---|
| 6 |
Error:
Run Time : 3.9e-05
Test 3
Verdict: ACCEPTED
| input |
|---|
| 10 10 5 4 10 7 8 4 1 8 9 2 |
| correct output |
|---|
| 5 |
| user output |
|---|
| 5 |
Error:
Run Time : 4e-05
Test 4
Verdict: ACCEPTED
| input |
|---|
| 1 1000000000 1 |
| correct output |
|---|
| 1000000000 |
| user output |
|---|
| 1000000000 |
Error:
Run Time : 4.7e-05
Test 5
Verdict: ACCEPTED
| input |
|---|
| 1 1000000000 1000000000 |
| correct output |
|---|
| 1000000000000000000 |
| user output |
|---|
| 1000000000000000000 |
Error:
Run Time : 4.1e-05
Test 6
Verdict: ACCEPTED
| input |
|---|
| 1000 1000 271 687 392 992 11 410 702 870... |
| correct output |
|---|
| 223 |
| user output |
|---|
| 223 |
Error:
Run Time : 0.000328
Test 7
Verdict: ACCEPTED
| input |
|---|
| 1000 1000 598 523 703 794 737 689 724 26... |
| correct output |
|---|
| 282 |
| user output |
|---|
| 282 |
Error:
Run Time : 0.000338
Test 8
Verdict: ACCEPTED
| input |
|---|
| 200000 1000000000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
| correct output |
|---|
| 5000 |
| user output |
|---|
| 5000 |
Error:
Run Time : 0.082047
Test 9
Verdict: ACCEPTED
| input |
|---|
| 200000 1 760045594 599341056 300698860 ... |
| correct output |
|---|
| 8214 |
| user output |
|---|
| 8214 |
Error:
Run Time : 0.095808
Test 10
Verdict: ACCEPTED
| input |
|---|
| 200000 1000000000 33941840 210038922 596070148 7... |
| correct output |
|---|
| 371045814100 |
| user output |
|---|
| 371045814100 |
Error:
Run Time : 0.152893
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 |
Error:
Run Time : 5.7e-05
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 |
Error:
Run Time : 4.4e-05
Test 13
Verdict: ACCEPTED
| input |
|---|
| 23 1000000000 1000000000 1000000000 10000000... |
| correct output |
|---|
| 43478261000000000 |
| user output |
|---|
| 43478261000000000 |
Error:
Run Time : 6.1e-05
Test 14
Verdict: ACCEPTED
| input |
|---|
| 23 1000000000 1000000000 1000000000 10000000... |
| correct output |
|---|
| 43478261000000000 |
| user output |
|---|
| 43478261000000000 |
Error:
Run Time : 7.8e-05
Test 15
Verdict: ACCEPTED
| input |
|---|
| 3 3 10 11 12 |
| correct output |
|---|
| 12 |
| user output |
|---|
| 12 |
Error:
Run Time : 3.8e-05
