Submission #790369

#TimeUsernameProblemLanguageResultExecution timeMemory
790369Valters07Measures (CEOI22_measures)C++14
59 / 100
158 ms5424 KiB
#include <bits/stdc++.h> #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt") #define fio ios_base::sync_with_stdio(0);cin.tie(0); #define ll long long #define en cin.close();return 0; #define pb push_back #define fi first//printf("%lli\n",cur); #define se second//scanf("%lli",&n); using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int main() { fio // ifstream cin("in.in"); int n, m, d; cin >> n >> m >> d; if(n>0) { vector<int> a(n); for(auto &x:a) cin >> x; while(m--) { int x; cin >> x; a.pb(x); sort(a.begin(),a.end()); n = a.size(); vector<ll> c(n); for(int i = 0;i<n;i++) c[i]=1ll*d*i-a[i]; ll mi = 1e18, res = -1e18; for(int i = 0;i<n;i++) res=max(res,c[i]-mi), mi=min(mi,c[i]); cout << res/2; if(res%2) cout << ".5"; cout << " "; } } else { ll mi = 1e18, res = 0; for(int i = 0;i<m;i++) { int x; cin >> x; ll c = 1ll*d*i-x; res=max(res,c-mi); mi=min(mi,c); cout << res/2; if(res%2) cout << ".5"; cout << " "; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...