QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#466658 | #8524. Weather Forecast | El_7la2een# | Compile Error | / | / | C++17 | 929b | 2024-07-08 00:20:34 | 2024-07-08 00:20:34 |
Judging History
answer
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
int n, k;
bool check(vector<double>& v, double avg) {
double sum = 0, num = 0;
int cnt = 0;
for (auto& i : v) {
sum += i;
num++;
double av = sum / num;
if (avg <= av) {
cnt++;
sum = 0;
num = 0;
}
}
return (cnt >= k);
}
signed main() {
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
cin >> n >> k;
vector<double>v(n);
for (auto& i : v)cin >> i;
double l = 0, r = 10000;
double ans = 0;
for (int i = 0; i < 60; i++) {
double md = (l + r) / 2.0;
if (check(v, md)) {
ans = md;
l = md;
}
else r = md;
}
cout << fixed << setprecision(12) << ans << "\n";
}
Details
In file included from /usr/include/c++/13/string:43, from /usr/include/c++/13/bitset:52, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52, from answer.code:4: /usr/include/c++/13/bits/allocator.h: In destructor ‘std::_Vector_base<double, std::allocator<double> >::_Vector_impl::~_Vector_impl()’: /usr/include/c++/13/bits/allocator.h:184:7: error: inlining failed in call to ‘always_inline’ ‘std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = double]’: target specific option mismatch 184 | ~allocator() _GLIBCXX_NOTHROW { } | ^ In file included from /usr/include/c++/13/vector:66, from /usr/include/c++/13/functional:64, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53: /usr/include/c++/13/bits/stl_vector.h:133:14: note: called from here 133 | struct _Vector_impl | ^~~~~~~~~~~~