Submission #403086

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
4030862021-05-12 18:02:30PietraRice Hub (IOI11_ricehub)C++14
100 / 100
20 ms3276 KiB
#include<bits/stdc++.h>
#include <ricehub.h>
#define pii pair<int,int>
#define f first
#define ll long long
#define s second
#define pb push_back
using namespace std ;
const int maxn = 1e5 + 5 ;
ll n, mx, p[maxn], num[maxn], qtd, indbest ;
bool ok(int k){
if(k == 1) return true ;
// cout << "com k = " << k << ":\n" ;
ll c = p[k] - p[1] -((k-1)*num[1]) ;
indbest = 1 ;
for(int i = 2 ; i <= k ; i++){
ll ans = p[k] - p[i] - ((k-i)*num[i]) + ((i - 1)*num[i]) - p[i-1] ;
if(ans <= c) c = ans, indbest = i ;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...