Submission #330772

#TimeUsernameProblemLanguageResultExecution timeMemory
330772Valera_GrinenkoCooking (innopolis2018_final_B)C++17
100 / 100
1 ms492 KiB
#pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #pragma GCC optimization ("unroll-loops") #include <iostream> #include <fstream> #include <algorithm> #include <vector> #include <set> #include <stack> #include <map> #include <unordered_map> #include <iomanip> #include <cmath> #include <queue> #include <bitset> #include <numeric> #include <array> #include <cstring> #include <random> #include <chrono> #define fi first #define se second #define pb push_back #define mp make_pair #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin()) typedef long long ll; typedef long double ld; using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; // template<class T> // using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ld k, d, t; cin >> k >> d >> t; ld l = t, r = 2 * t; ld onec = ((ll)k + (ll)d - 1) / (ll)d * d; ld get = k * 2 + (onec - k); for(int it = 0; it < 250; it++) { ld mid = (l + r) / 2.; ld curget = (ll)mid / (ll)onec * get; ld left = mid - ((ll)mid / (ll)onec) * onec; if(left <= k) curget += left * 2.; else { curget += k * 2.; curget += (left - k); } if(curget >= t * 2.) r = mid; else l = mid; } cout << fixed << setprecision(10) << l; return 0; } /* */

Compilation message (stderr)

B.cpp:3: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
    3 | #pragma GCC optimization ("unroll-loops")
      |
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...