Submission #1243089

#TimeUsernameProblemLanguageResultExecution timeMemory
1243089hoangmc2009경주 (Race) (IOI11_race)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define fi first #define se second #define Log2(x) 63-__builtin_clzll(x) using namespace std; using i64 = long long; using f64 = long double; using ui64 = unsigned long long; using pII = pair<int,int>; mt19937 rng32(time(0)); mt19937_64 rng64(chrono::steady_clock::now().time_since_epoch().count()); i64 n,L,K,a[100009],pre[100009]; bool check(int x) { for(int r=x;r<=n;++r) { int l=r-x+1; int med=(l+r)/2; //i64 sumL=a[med]*(med-l+1)-pre[med]+pre[l-1]; //i64 sumR=pre[r]-pre[med]-a[med]*(r-med); if(a[med]*(2*med-l-r+1)+pre[l-1]+pre[r]-2*pre[med]<=K) return true; } return false; } int besthub(int R,int L,int X[],i64 B) { ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);n=R;K=B; for(int i=0;i<R;++i) a[i+1]=X[i]; for(int i=1;i<=n;++i) pre[i]=pre[i-1]+a[i]; int l=1,r=n,mid; while(l<=r) { mid=(l+r)/2; if(check(mid)) l=mid+1; else r=mid-1; } return r; } /* ........................ ..::-+**#%@@@@@@@@@@@@@@@@@@%#**+::.. ..:=++#%%@@@@@@@@@@@@@@@@%%%%%%%%%@@@@@@@@@@@@%+. ..:-+*#%@@@@@@@@%%%%##############################%%@@@@*:. ..:-+*%@@@@@@@%%%##########################################%@@@@+:. ..:=+%@@@@@@%%#####################################################@@@@+.. ....-+%@@@@@@%#############################################################@@@@=.. ..=#@@@@@%%###################################################################%@@@%-. .:+#%@@@@%%#########################################################################%@@@#:. .:=*%@@@%%###############################################################################%@@@@-. ..-*%@@@%%#####################################################################################%@@@=. ..+@@@@###########################################################################################%@@@*.. .*@@@#*##############################################################################################@@@%. .+@@@#**################################################################################################@@@%:. .-%@@#**####%##############################################################################################%@@%:. .+@@#***###%%################################################################################################%@@@-. :#@%****###%%*#################################################################################################%@@@-. -@@%****###@%*###################################################################################################%@@@-. -@@#***###%@#*#####################################################################################################%@@@=. -@@#***###@@#*#######################################################################################################@@@%-. :@@#***###@%**#########################################################################################################@@@+. :%@#***##%@%**##########################################################################################################%@@@. .#@%***##%@%**############################################################################################################%@@*. .+@%***##@@#**##############################################################################################@@##############@@@:. :@@***##@@#**###############################################################################################@@@%############%@@#. .%@#***#@@#**####################################%@@%#######################################################@@@@@@############@@@=. .*@%***%@@#***##################################%@@@@@@@%###################################################%@@@@@@@############@@%. -@@***%@@#***##################################@@@@@@@@@@@%#################################################@@@@@@@@@###########@@@=. .#@#**#@@#****################################%@@@@@@@@@@@@@@@%#############################################%@@@@@@@@@@###########@@%. =@%**#@@%****################################@@@@@@@@@@@@@@@@@@@%###########################################@@@@@@@@@@@@##########%@@=. .@@**#@@%*****##############################%@@@@@@@@@@@@@@@@@@@@@@@########################################@@@@@@@@@@@@@@##########@@%. .#@###@@%*****##############################@@@@@@@@@@@@@@@@@@@@@@@@@@@#####################################@@@@@@@@@@@@@@@@#########@@@- ..#@###%@@******############################%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@##################################%@@@@@@@@@@@@@@@@@#########@@#. .-%@###%@@#*****############################%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@###############################%@@@@@@@@@@@@@@@@@@@########@@@:. ...-%@%####@@#******###########################@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%############################%@@@@@@@@@@@@@@@@@@@@%#######%@@*. ..:+%@@######%@%******###########################@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%##########################@@@@@@@@@@@@@@@@@@@@@@%#######@@@. .#@%%%##########@@*******#########################%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%######################%@@@@@@@@@@@@@@@@@@@@@@@@%######%@@+. :#@%##########@@#******#########################@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@####################%@@@@@@@@@@@@@@@@@@@@@@@@@@#######@@%. .+%@%#######%@%*******########################@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%#################%@@@@@@@@@@@@@@@@@@@@@@@@@@@@######%@@-. .+%@@%####@@#******#######################%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@###############%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@######@@#. .:*%@@@@@%*******######################%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#############@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%#####%@@:. .....-@@********#####################%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%#########%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%#####@@*. .=@%*******#####################%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#######@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#####@@@. .%@#*******####################@@@@@@@@@@@@@@@@@@@@@@@@@@%##*******##%@@@@@@@@@@@@@@@@@@@@@@####%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#####@@=. .+@@********###################@@@@@@@@@@@@@@@@@@@@@@#*=:...............:=*#@@@@@@@@@@@@@@@@@@#%@@@@@@@@@@@@@@#*+-:.......:-=+#%@@@@@@@@@%####@@%. .@@%*******###################@@@@@@@@@@@@@@@@@@@@#-.........................-*%@@@@@@@@@@@@@@@@@@@@@@@@@@%*-....................=#@@@@@@@#####@@=. .+@@********##################@@@@@@@@@@@@@@@@@@@=...............................-%@@@@@@@@@@@@@@@@@@@@@@%-..........................=@@@@@@####@@%. :@@@********#################@@@@@@@@@@@@@@@@@@=...................................-@@@@@@@@@@@@@@@@@@@@-..............................+@@@@%####@@+. .*@@#********################%@@@@@@@@@@@@@@@@#:..........................:=+++=:....:*@@@@@@@@@@@@@@@@*:....:=+++=:.....................:%@@@####%@@:. :@@@********################%@@@@@@@@@@@@@@@@*...........................=*#%%%#*=.....+@@@@@@@@@@@@@@=.....-*#%%%#*-.....................:#@@%####@@#. .*@@%********###############%@@@@@@@@@@@@@@@@#...........................-*%@@@@@%*-.....*@@@@@@@@@@@@+.....-*%@@@@@#*-.....................:@@@####%@@*. .=@@@*********###############@@@@@@@@@@@@@@@@@:...........................*=-@@@@@@#*.....:@@@@@@@@@@@@......*=+@@@@@@*+......................=@@@####@@@=. -@@@**********##############@@@@@@@@@@@@@@@@@#............................*..+@@@@@#*......#@@@@@@@@@@*.....:*..#@@@@@#*......................:@@@%####@@@=. .+@@@#**********#############%@@@@@@@@@@@@@@@@@*............................+-.%@@@@@*+......#@@@@@@@@@@+......*:.%@@@@@*+.......................@@@@#####@@@=. .-%@@@***********##############@@@@@@@@@@@@@@@@@@#............................-*#@@@@@#*:......%@@@@@@@@@@+......=*#@@@@@#*:......................:@@@@%#####@@@+. ..=#@@@#************#############@@@@@@@@@@@@@@@@@@@@:............................-+*###*+:......:@@@@@@@@@@@#.......=*#%%#*+:.......................=@@@@@######@@@#. ...:=*@@@%#*************#############%@@@@@@@@@@@@@@@@@@@@*..............................:===:........#@@@@@@@@@@@@-.......:=++=-.........................%@@@@@@######@@@%-. .-+*%@@@@%#****************#############@@@@@@@@@@@@@@@@@@@@@@=.........................................+@@@@@@@@@@@@@@:....................................#@@@@@@@#######%@@@*.. -@@%**********************#############%@@@@@@@@@@@@@@@@@@@@@@@+.......................................#@@@@@@@@@@@@@@@@:..................................#@@@@@@@@@########@@@@=. .:%@%********************##############@@@@@@@@@@@@@@@@@@@@@@@@@%-...................................=@@@@@@@@@@@@@@@@@@@*...............................=@@@@@@@@@@@%########%@@@%+. .+@@#******************##############@@@@@@@@@@@@@@@@@@@@@@@@@@@#=..............................:+%@@@@@@@@@@@@@@@@@@@@@%+:..........................=#@@@@@@@@@@@@@##########%@@@@*:. .:%@@#****************#############%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%+-........................:=*@@@@@@@@@%%@@@@@@@@@@%@@@@@*-:....................-+@@@@@@@@@@@@@@@@%###########%@@@+. .+@@%***************#############%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*=-:..............::-+#@@@@@@@%#+-:::-#@@@@@@#::-+#@@@@@#=-::.........::-=*@@@@@@@@@@@@@@@@@@@@##########%@@@+. .#@@%*************#############@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#*++++++*#%@@@@@@@@@@%=:::::::::::+@@@=:::::::-#@@@@@@@@@%%%%%@@@@@@@@@@@@@@@@@@@@@@@@@@@%########%@@@=. .-%@@%************############@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#=-:::::::::::::::-:::::::::::-=@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%#######@@@@-. ..=%@@%**********############@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+-:::::::::::::::::::::::::::::::::=%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@######%@@@#:. .=%@@%*********###########%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%=:::::::::::::::-+####=::::::::::::::::+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%######@@@@=.. .=%@@%#*******############%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%=::::::::::::::::+#+-::=#*::::::::::::::::-#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@######%@@@%-. .=%@@@#******#############%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+:::::::::::::::::*-:::::::*+:::::::::::::::::*@@@@@@@@@@@@@@@@@@@@@@@@@@@%######%@@@+.. .-%@@@%*****###############@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#::::::::::::::::::-::::::::::=::::::::::::::::::=@@@@@@@@@@@@@@@@@@@@@@@@@#######@@@@:. ..-#@@@@#***################@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@=::::::::::::::::::::::::::::::::::::::::::::::::::-@@@@@@@@@@@@@@@@@@@@@@%######@@@@+.. .:+@@@@%#**################%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%-::::::::::::::::::::::::::::::::::::::::::::::::::::-@@@@@@@@@@@@@@@@@@@%######%@@@*:. ..=#@@@@#**################%%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#:::::::::::::::::::::::::::::::::::::::::::::::::::::::=@@@@@@@@@@@@@@@@%######%@@@#-. .:*%@@@%###################%@@@@@@@@@@@@@@@@@@@@@@@@@@*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::+@@@@@@@@@@@@@%#######@@@%=.. .-#@@@@%###################%@@@@@@@@@@@@@@@@@@@@@@*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::-=@@@@@@@@@@@%######%@@@%=.. ...-%@@@@@####################@@@@@@@@@@@@@@@@@@@@+::::::::::::::::::::::::::::::::::::::::::::::::::::::-#@@@@@@@@@@@%######%@@@%-.. ...-#@@@@@%###################%@@@@@@@@@@@@@@@@@@@#+:::::::::::::::::::::::::::::::::::::::::::::::+%@@@@@@@@@@@%######%@@@@*:.. ..:-*@@@@@@%%##################%@@@@@@@@@@@@@@@@@@%#+=:::::::::::::::::::::::::::::::::::::=*#%@@@@@@@@@@@%######%@@@@@#=.. ..-+#@@@@@@%%##################%%@@@@@@@@@@@@@@@@@@%*+==-:::::::::::::::::::::::-=+*#%@@@@@@@@@@@@@%######%@@@@@*-:.. ..=#%@@@@@@%%###################%@@@@@@@@@@@@@@@@@@@@@%#*+===------===+*#%@@@@@@@@@@@@@@@@@@%######%@@@@@%*-. ..-*@@@@@@@@@%####################%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%#######%@@@@@@#-.. .....=#@@@@@@@@@@%######################%%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%########%@@@@@@%+:... ..::=*%@@@@@@@@@@%%#######################%%%%%@@@@@@@@@@@@%%%%############%@@@@@@@%=:.. ...-=+#%@@@@@@@@@@@@%%%##########################################%%@@@@@@%*=-:.. ...:-+*#%@@@@@@@@@@@@@@%%%%%#########################%%%@@@@@@@%*=:.. ...*@@%@@@@@@@@@@@@@@@@@@@@@@@%%%%%%####%%@@@@@@@@%#+:.. .*@@****#####%%%@@@@@@@@@@@@@@@@@@@@@@@@@@@@#=:.. .@@%****##########@#====%%###@##@%%%@@@%-:.... -@@#****##########@#===+@#***@%=@%###@@%. =@@*****##########%@===#@#***%@=%@###%@@- .*@@*****###########@*==*%%%%%@@+@%###%@@+. .@@%****############%@+=====++==%@#####@@%. =@@#****#############@@========#@######@@@. .*@@*****############@@%@+=====*@#######@@@=. .%@@*****###########%@##@@#===#@########%@@*. -@@%****###########%@%##@%%%*#@##########@@%. =@@#****###########@%###@##%@@###########@@@-. +@@*****##########@@###%@##%@@###########@@@+. .%@@****##########@@####@%##%@@###########%@@%. -@@%****#########@@#####@###%@@############@@@: =@@#****########%@#####%@####@@############@@@=. #@@*****#######%@######@%####@@############%@@#. .%@@****#######%@######%@#####@@############%@@%. -@@%****######%@#######%@#####@@%############@@@-. =@@#****#####%@########@%#####@@%############@@@+. +@@#****####%@########%@######@@%############%@@#. .%@@****####%@#########@@######@@%############%@@@: :@@%****###%@##########@%######@@%#############@@@=. =@@%****##%%##########%@#######@@%#############@@@*. #@@#****#%%###########@@#######@@@#############%@@%. .%@@*****%############%@%#######@@@#############%@@@: -@@@****##############@@########%@@##############@@@+. -@@%****##############@%########%@@##############@@@#. .*@@#****#############@@#########%@@##############%@@@: .%@@*****#############@%#########%@@##############%@@@-. :@@@*****############%@##########%@@###############@@@*. -@@%*****############@%##########%@@###############@@@%. #@@#****############%@############@@###############%@@@: .%@@#****############@%############@@%###############@@@=. :@@@*****###########%@#############@@%###############@@@*. -@@%*****###########@%#############@@%###############@@@%. =@@%*****##########%@##############@@%###############%@@@: .#@@#*****##########@%##############@@%################@@@+. :@@@*****###########@###############@@%################@@@#. */

Compilation message (stderr)

/usr/bin/ld: /tmp/cc75pqpV.o: in function `main':
grader.cpp:(.text.startup+0x28): undefined reference to `best_path(int, int, int (*) [2], int*)'
collect2: error: ld returned 1 exit status