Submission #1282657

#TimeUsernameProblemLanguageResultExecution timeMemory
1282657zagaroRice Hub (IOI11_ricehub)C++20
0 / 100
1 ms568 KiB
#include<bits/stdc++.h>
#include "ricehub.h"
#include<ext/pb_ds/assoc_container.hpp>
/**zagaro & lauren <3**/
#define mod 1000000007 //1e9 + 7
#define pi acos(-1)
#define wl while
#define str string
#define ENDL "\n"
#define sal ' '
#define tp_set ll
#define prc(n) cout.precision(n);cout<<fixed;
#define ord_set tree<tp_set, null_type, less<tp_set>, rb_tree_tag, tree_order_statistics_node_update>
typedef long long ll;
typedef bool bl;
typedef char car;
using namespace std;
using namespace __gnu_pbds;
int besthub(int R, int L, int X[], long long B){
    ll r=1, p=(R+1)/2, a, b, x, y;
    a = p-1;b=p+1;
    wl(B != 0){
        if(a < 0)x=LONG_LONG_MAX;
        else x = abs(X[p]-X[a]);
        if(b >= R)y=LONG_LONG_MAX;
        else y = abs(X[p]-X[b]);
        if(min(x, y) > B)B=0;
        else if(x < y){
            B-=x;
            r++;
            a--;
        }
        else {
            B-=y;
            r++;
            b++;
        }
    }
    return r;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...