Submission #1208482

#TimeUsernameProblemLanguageResultExecution timeMemory
1208482PlayVoltz도넛 (JOI14_ho_t3)C++20
100 / 100
380 ms1864 KiB
#include <cstdio> #include <stdio.h> #include <stdbool.h> #include <iostream> #include <map> #include <vector> #include <climits> #include <stack> #include <string> #include <queue> #include <algorithm> #include <set> #include <unordered_set> #include <unordered_map> #include <cmath> #include <cctype> #include <bitset> #include <iomanip> #include <cstring> #include <numeric> #include <cassert> #include <chrono> using namespace std; #define int long long #define pii pair<int, int> #define mp make_pair #define pb push_back #define fi first #define se second int n; vector<int> vect; bool check(int mid){ for (int i=1; i<=n; ++i){ int id=lower_bound(vect.begin(), vect.end(), vect[i-1]+mid)-vect.begin()+1; if (id>=i+n)continue; id=lower_bound(vect.begin(), vect.end(), vect[id-1]+mid)-vect.begin()+1; if (id>=i+n)continue; id=lower_bound(vect.begin(), vect.end(), vect[id-1]+mid)-vect.begin(); if (id>=i+n)continue; return 1; } return 0; } int32_t main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n; vect.resize(2*n+1, 0); for (int i=1; i<=n; ++i)cin>>vect[i], vect[i+n]=vect[i]; for (int i=1; i<=2*n; ++i)vect[i]+=vect[i-1]; int low=0, high=LLONG_MAX/2; while (low+1<high){ int mid=(low+high)/2; if (check(mid))low=mid; else high=mid; } cout<<low; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...