Submission #582097

#TimeUsernameProblemLanguageResultExecution timeMemory
582097amunduzbaevBoarding Passes (BOI22_passes)C++17
0 / 100
0 ms212 KiB
#include "bits/stdc++.h" using namespace std; #define ar array typedef int64_t ll; #define int ll const int N = 1e5 + 5; int pref[N], suff[N]; signed main(){ ios::sync_with_stdio(0); cin.tie(0); //~ string s; cin>>s; //~ int n = s.size(); int n; cin>>n; for(int i=0;i<n;i++){ if(i) pref[i] += pref[i-1]; pref[i] += i; } for(int i=n-1;~i;i--){ suff[i] += suff[i+1]; suff[i] += (n - i - 1); } int res = pref[n-1]; for(int i=1;i<n;i++){ res = min(res, pref[i-1] + suff[i]); } double rr = res / 2.; cout<<fixed<<setprecision(1)<<rr<<"\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...