Task: | Aquarium |
Sender: | aalto2024a_001 |
Submission time: | 2024-09-04 16:44:46 +0300 |
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 | TIME LIMIT EXCEEDED | -- | details |
#35 | TIME LIMIT EXCEEDED | -- | details |
#36 | TIME LIMIT EXCEEDED | -- | details |
#37 | TIME LIMIT EXCEEDED | -- | details |
#38 | TIME LIMIT EXCEEDED | -- | details |
#39 | TIME LIMIT EXCEEDED | -- | details |
#40 | TIME LIMIT EXCEEDED | -- | details |
#41 | TIME LIMIT EXCEEDED | -- | details |
#42 | TIME LIMIT EXCEEDED | -- | details |
#43 | TIME LIMIT EXCEEDED | -- | details |
#44 | TIME LIMIT EXCEEDED | -- | details |
Code
#ifdef ONPC #define _GLIBCXX_DEBUG #endif #include <bits/stdc++.h> #define char unsigned char #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() #define eb emplace_back #define mp make_pair #define mt make_tuple #define fi first #define se second #define pb push_back #define LSOne(S) ((S) & -(S)) using namespace std; // mt19937 rnd(239); mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); typedef long long C; typedef complex<C> P; #define X real() #define Y imag() template<class T> istream& operator>> (istream& is, complex<T>& p) { T value; is >> value; p.real(value); is >> value; p.imag(value); return is; } typedef long long ll; typedef long double ld; using pi = pair<ll, ll>; using vi = vector<ll>; template <class T> using pq = priority_queue<T>; template <class T> using pqg = priority_queue<T, vector<T>, greater<T>>; int popcnt(int x) { return __builtin_popcount(x); } int popcnt(ll x) { return __builtin_popcountll(x); } #define MIN(v) *min_element(all(v)) #define MAX(v) *max_element(all(v)) #define LB(c, x) distance((c).begin(), lower_bound(all(c), (x))) #define UB(c, x) distance((c).begin(), upper_bound(all(c), (x))) void __print(int x) {cerr << x;} void __print(long x) {cerr << x;} void __print(long long x) {cerr << x;} void __print(unsigned x) {cerr << x;} void __print(unsigned long x) {cerr << x;} void __print(unsigned long long x) {cerr << x;} void __print(float x) {cerr << x;} void __print(double x) {cerr << x;} void __print(long double x) {cerr << x;} void __print(char x) {cerr << '\'' << x << '\'';} void __print(const char *x) {cerr << '\"' << x << '\"';} void __print(const string &x) {cerr << '\"' << x << '\"';} void __print(bool x) {cerr << (x ? "true" : "false");} template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ", "; __print(x.second); cerr << '}';} template<typename T> void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? ", " : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";} template <typename T, typename... V> void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);} #ifdef DEBUG #define dbg(x...) cerr << "\e[91m"<<__func__<<":"<<__LINE__<<" [" << #x << "] = ["; _print(x); cerr << "\e[39m" << endl; #else #define dbg(x...) #endif template<typename S, typename T = S> void chmin(S &s, T t) {s = s < t ? s : t;} template<typename S, typename T = S> void chmax(S &s, T t) {s = s > t ? s : t;} const int INF = 1e9; // 10^9 = 1B is < 2^31-1 const ll LLINF = 4e18; // 4*10^18 is < 2^63-1 const double EPS = 1e-4; const ll MOD = 1e9+7; const int N=1e4+10; float v[N]; int n; ll q, V; bool ok(float target) { int left=q, right=q; while(left>=1 && v[left]<target) left--; while(right<=n && v[right]<target) { right++; //std::cout << "+"; } if(left==0 || right==n+1) return false; float need=(right-left-1)*target; //for (int i = left+1; i < right-1; i++) { //need+=target; //} //std::cout << target << " " << left << " " << right << " need: " << need<< std::endl; return need<=V; } int solve() { std::cin >> n; //vector<float> v(n); for (int i = 1; i <= n; i++) { std::cin >> v[i]; } std::cout << fixed << setprecision(8); std::cin >> q >> V; float lo=0.0, hi=2000000.0; while(hi-lo>EPS) { float mid=(lo+hi)/2; if(ok(mid)) { lo=mid; } else { hi=mid; } } //std::cout << lo << " " << hi << std::endl; std::cout << hi << std::endl; return 0; } int32_t main() { ios::sync_with_stdio(0); cin.tie(0); int TET = 1; //cin >> TET; for (int i = 1; i <= TET; i++) { #ifdef ONPC cout << "TEST CASE#" << i << endl; #endif if (solve()) { break; } #ifdef ONPC cout << "__________________________" << endl; #endif } #ifdef ONPC cerr << endl << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl; #endif }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
1 1 1 1 |
correct output |
---|
1 |
user output |
---|
1.00000763 |
Test 2
Verdict: ACCEPTED
input |
---|
2 1 2 1 1 |
correct output |
---|
1 |
user output |
---|
1.00000763 |
Test 3
Verdict: ACCEPTED
input |
---|
3 1 1 3 2 7 |
correct output |
---|
1 |
user output |
---|
1.00000763 |
Test 4
Verdict: ACCEPTED
input |
---|
5 1 1 5 3 5 3 6 |
correct output |
---|
5 |
user output |
---|
5.00003815 |
Test 5
Verdict: ACCEPTED
input |
---|
6 5 3 1 2 4 6 3 4 |
correct output |
---|
2 |
user output |
---|
2.00001526 |
Test 6
Verdict: ACCEPTED
input |
---|
8 7 5 3 1 2 4 6 8 4 7 |
correct output |
---|
3 |
user output |
---|
3.00002289 |
Test 7
Verdict: ACCEPTED
input |
---|
9 2 1 9 5 9 4 5 4 3 4 5 |
correct output |
---|
5 |
user output |
---|
5.00003815 |
Test 8
Verdict: ACCEPTED
input |
---|
10 9 7 5 3 1 2 4 6 8 10 5 11 |
correct output |
---|
3.66667 |
user output |
---|
3.66667509 |
Test 9
Verdict: ACCEPTED
input |
---|
12 11 9 7 5 3 1 2 4 6 8 10 12 6 16 |
correct output |
---|
4 |
user output |
---|
4.00003052 |
Test 10
Verdict: ACCEPTED
input |
---|
14 13 11 9 7 5 3 1 2 4 6 8 10 12 ... |
correct output |
---|
5 |
user output |
---|
5.00003815 |
Test 11
Verdict: ACCEPTED
input |
---|
16 15 13 11 9 7 5 3 1 2 4 6 8 10 ... |
correct output |
---|
5.6 |
user output |
---|
5.60004282 |
Test 12
Verdict: ACCEPTED
input |
---|
18 17 15 13 11 9 7 5 3 1 2 4 6 8 ... |
correct output |
---|
6 |
user output |
---|
6.00004578 |
Test 13
Verdict: ACCEPTED
input |
---|
20 19 17 15 13 11 9 7 5 3 1 2 4 6... |
correct output |
---|
7 |
user output |
---|
7.00005341 |
Test 14
Verdict: ACCEPTED
input |
---|
25 5 1 24 14 24 11 13 11 9 9 4 6 ... |
correct output |
---|
6 |
user output |
---|
6.00004578 |
Test 15
Verdict: ACCEPTED
input |
---|
30 29 27 25 23 21 19 17 15 13 11 ... |
correct output |
---|
10 |
user output |
---|
10.00001812 |
Test 16
Verdict: ACCEPTED
input |
---|
40 39 37 35 33 31 29 27 25 23 21 ... |
correct output |
---|
13.4615 |
user output |
---|
13.46157074 |
Test 17
Verdict: ACCEPTED
input |
---|
50 49 47 45 43 41 39 37 35 33 31 ... |
correct output |
---|
17 |
user output |
---|
17.00001335 |
Test 18
Verdict: ACCEPTED
input |
---|
70 69 67 65 63 61 59 57 55 53 51 ... |
correct output |
---|
23.2609 |
user output |
---|
23.26088715 |
Test 19
Verdict: ACCEPTED
input |
---|
1 1 1 1 |
correct output |
---|
1 |
user output |
---|
1.00000763 |
Test 20
Verdict: ACCEPTED
input |
---|
2 3 2 1 16 |
correct output |
---|
3 |
user output |
---|
3.00002289 |
Test 21
Verdict: ACCEPTED
input |
---|
3 6 4 3 3 81 |
correct output |
---|
3 |
user output |
---|
3.00002289 |
Test 22
Verdict: ACCEPTED
input |
---|
5 14 8 5 24 16 5 625 |
correct output |
---|
16 |
user output |
---|
16.00000572 |
Test 23
Verdict: ACCEPTED
input |
---|
6 19 11 6 34 23 35 3 1296 |
correct output |
---|
19 |
user output |
---|
19.00002861 |
Test 24
Verdict: ACCEPTED
input |
---|
8 32 18 9 61 39 62 32 35 4 4096 |
correct output |
---|
61 |
user output |
---|
61.00000381 |
Test 25
Verdict: ACCEPTED
input |
---|
9 40 22 10 77 49 78 40 44 39 3 6561 |
correct output |
---|
40 |
user output |
---|
40.00001526 |
Test 26
Verdict: ACCEPTED
input |
---|
10 49 26 12 94 60 96 49 54 48 39 4 10000 |
correct output |
---|
94 |
user output |
---|
94.00001526 |
Test 27
Verdict: ACCEPTED
input |
---|
12 69 36 15 135 85 138 69 76 67 5... |
correct output |
---|
69 |
user output |
---|
69.00006104 |
Test 28
Verdict: ACCEPTED
input |
---|
14 93 47 18 184 114 187 93 102 90... |
correct output |
---|
141 |
user output |
---|
141.00006104 |
Test 29
Verdict: ACCEPTED
input |
---|
16 121 60 22 240 148 244 120 132 ... |
correct output |
---|
240 |
user output |
---|
240.00003052 |
Test 30
Verdict: ACCEPTED
input |
---|
18 151 74 25 303 186 308 151 166 ... |
correct output |
---|
303 |
user output |
---|
303.00006104 |
Test 31
Verdict: ACCEPTED
input |
---|
20 186 90 29 374 229 381 185 204 ... |
correct output |
---|
286 |
user output |
---|
286.00006104 |
Test 32
Verdict: ACCEPTED
input |
---|
25 287 136 40 584 355 594 286 316... |
correct output |
---|
516 |
user output |
---|
516.00006104 |
Test 33
Verdict: ACCEPTED
input |
---|
30 409 191 52 841 508 855 409 452... |
correct output |
---|
656 |
user output |
---|
656.00006104 |
Test 34
Verdict: TIME LIMIT EXCEEDED
input |
---|
40 720 328 80 1494 898 1519 719 7... |
correct output |
---|
1519 |
user output |
---|
(empty) |
Test 35
Verdict: TIME LIMIT EXCEEDED
input |
---|
50 1118 503 113 2333 1397 2372 11... |
correct output |
---|
2372 |
user output |
---|
(empty) |
Test 36
Verdict: TIME LIMIT EXCEEDED
input |
---|
70 2176 964 195 4570 2725 4648 21... |
correct output |
---|
4648 |
user output |
---|
(empty) |
Test 37
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 4416 1932 356 9323 5542 9483 4... |
correct output |
---|
9700 |
user output |
---|
(empty) |
Test 38
Verdict: TIME LIMIT EXCEEDED
input |
---|
500 104548 249301 180224 233177 52... |
correct output |
---|
104548 |
user output |
---|
(empty) |
Test 39
Verdict: TIME LIMIT EXCEEDED
input |
---|
600 150482 358999 259492 335771 64... |
correct output |
---|
353835 |
user output |
---|
(empty) |
Test 40
Verdict: TIME LIMIT EXCEEDED
input |
---|
900 446578 58127 573897 680544 236... |
correct output |
---|
790626 |
user output |
---|
(empty) |
Test 41
Verdict: TIME LIMIT EXCEEDED
input |
---|
900 783372 729637 443692 140636 78... |
correct output |
---|
805592 |
user output |
---|
(empty) |
Test 42
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 4416 1932 356 9323 5542 9483 4... |
correct output |
---|
9700 |
user output |
---|
(empty) |
Test 43
Verdict: TIME LIMIT EXCEEDED
input |
---|
500 104548 249301 180224 233177 52... |
correct output |
---|
104548 |
user output |
---|
(empty) |
Test 44
Verdict: TIME LIMIT EXCEEDED
input |
---|
600 150482 358999 259492 335771 64... |
correct output |
---|
353835 |
user output |
---|
(empty) |