Submission #1268431

#TimeUsernameProblemLanguageResultExecution timeMemory
1268431abyfuDetecting Molecules (IOI16_molecules)C++20
0 / 100
1 ms328 KiB
//OwO //#pragma GCC optimize("O3", "unroll-loops") #include <bits/stdc++.h> #include "molecules.h" #define ll long long #define ld long double #define namein "input.txt" #define nameout "output.txt" #define all(x) x.begin(),x.end() #define fi first #define se second #define pb push_back #define m_pi acos(-1) using namespace std; const ll inf = 7e18; const int linf = 1.5e9; vector<int> find_subset(int x, int y, vector<int> w) { vector<pair<int, int>> p; for (int i = 0; i < w.size(); i++) p.pb({w[i], i}); sort(all(p)); vector<int> res; int l = 0; int sx = 0; for (int i = 0; i < p.size(); i++){ sx += p[i].fi; if (sx > y){ while (l < i){ sx -= p[l].fi; l++; if (sx <= y) break; } if (sx >= x){ for (int j = l; j <= i; j++){ res.pb(p[j].se); } return res; } } } return {}; } /* ++++++***#@*--------------------------=---------------------------------------=----------------==----=--%+++++++++*#***++++++++*# ***%@@@%##+---------------------------#----------------------------------------+=-=-------------=+----+--%*+++++++++++++++++++**# ###******+-:-------------------------=----------------------------=--------------+-*-------------=+--::=-=*#+++++++++++++++++**## ++++++++=-:----------------- ---------#-------------------------------+------------+=*--------------+--::=-+++++++++++++++++++*#%% +++++++*-:--------------------------=+---------------------------------=+----------=**-------------=+--::=-+++++++++++++++++**#%# ++****%-:---------------------------=-------------------------------------+=----::---**--------=----==---:-#++++++++++++++**#%#*+ ++***%--:-+=------------------------+---------------------------------------==---::---=+---::---+----=---::-=*++++++++****#%%%*== ++**#=-:--+---==--------------------+-:----------------------------------------=---:::--+----:---+----*--:::::-+**++**#%%%%##*+== +*+*#-:--=----+----------------------:-------------------:--:----------:--+------*---:::-+---::--=+----=--:::::::--=+*#*#%%%%%##+ ***#-::--*---=*-------*-------------:::-------------------::-::::::::::::--#=--:--+*=--::-==-:::--++---+=--::::::----=*%@@@@@@@%% **+#-:---+---++------==--------------::------------------:--:::::--:::::::--+=-::-=++*--::--=-::--++=---++--:::::::=%@@@@@@@#*+++ **#=::--%=---*+------%-----=---------+:-----:-------------:::--::-----::::--*++-::-=+++*--::-=-::-=++---##++--:::::::--=+++++*=== **#-:--=@=--=*+-----++----*----------=------:----------==--::-=--::-=--::::-===+-:--+#+++*--:-=::-=++=---++#++=---:::::::---++=== **#-:-=%@=*-+*+----=#=----=-----------=------:-----::---*+--:--*--::-+=-:::--=-=+---=++++++=----:--+++---#++++*#++=========*++=== *#+-:-=@@===**+----+#=---+------------*------=-----:::--=*+--:--#--:--+=---+*#*++*--=*#*#*+*+--+---+++=--#==============++*++==== *#=::-+#@+==***---=*%----#-----+-------#------=---:::::--=**=---=*=---#*#=---+:::=+--=#-=++*=+--=--++++--++=======+++++%*++++==== %#=::-##@#==***=--=*#----*-----+=------%---:--=---:-::::--+**+---+++#+=#+=--:=::::==--*--+++=-+=+--++++--++==+%##%%@%**%+++===+++ @%---=@*@#==***=--=*#----+-----+#--::--%*--::--+--:::::::--++#*---#=+--=**---=:::::+--#::-%++--+===++++--*+===+%@@@@*++++++=+++++ *#---=%#@#=+***+--=*#----*--:--=#---:--@*=-:::--*--:::::::--++*+-==-==--+#=-+-::.::-*-%:::-*+---*+=+*++--%*+==++**%#+++++++++++++ +#=--=***%=+++**=-=*#=--+*-----=#*--:--#+#------+*--:::::::--+*++--*-*--*-*-=:::.:::*-=::::#*-::=+++*#+-=*--=#@@@%%**++++++++++++ ***--+*%@@=++++*+==**=--**=--+-=+%=----++=+=+******---::::::--+#=+==--+-*-%*+=----=+#*=-::--%-::-=+*+*+=**::-#@@**#@#+++++++++++# **#--+**%@=++++++==***--#*=--*+==##=--=*#===----=*=#-::::::::--+#=++=--#++#**@@@%%%%@@@@@+==*-::-++*+*+#+=::-#@#+++%@++++++++++++ @##=-++**@==++++++=++%==##+--=%==**#*=--%--==----+=-=-:--:::::-=**=+*--*#+@@%=--::-=----=*@*=-:-=+#++*#++-:::*==----------------- @@@*=+@**#+=+#+++++++*==**#=--*#+#%=+---==::+-----#+--*:----:::--*%-#::-##=--::::::::::::--+=--=+*+++#++*-:::#==--------------==- @@@@++@###+=+#*+++++++%==*#+--*#%=*+--*--#:::+==--=+::::#--+---:---*=::::::::::::::::::-:-*%=-+#==++++++#-::-#*****+======+**+=== %%%%*=@#*+#=++#*+++++++*=#+#=-#+=*=#-::*-=-:::+=+--+-::::=*-%+-------=*=::::::::-:-:-:--+#*=+#+--=+++++++-::-#++====----------=== ====*=#+++#==+#*+++++++++#++*==#=-++=:::-*+---*#+%==#=#::::-**=++--=%#*+-:::-:--:---:--==#+*-+---=+++++*=-:::*-**+==---------=++* ====+%*#@@@*=++#**+++++++**++*=*=---%-:::-+%#@@@@%%*=#-::::::-+%=--=====-:--:--:---:-:==--:::=:--++++++#--:::*--++======+**#*==-- ++++*%%@@#**-=+#%*+++++++*@*++*+*-:::*-:-+@@%*=---=+-+%-::::::::--*+-::::::--::::::::::::::::+---++++++#-::::*::-*+++**#@@@@#+++= @@@@@%@%##*=+-=*#%*++++++++%*++##-::::-+#@*--::::::::::::::::::::::::::::-:::::::::::::::::::+--=+++++*+-:::-+-::-#%@@@@@@@@@@@@@ @@@@@@@@@%%##==+#+%*++++++++****#*-:::=@@=-::::::::::::::::::::::::::::::::::::::::::::::::::+--=+++++*--:::-+=::-+@@@@@@@@@@@@@@ *+*%@@@@@@@@@@==*%++*++++++++++*#*%---#@=-:.:::--::---=::-::::-=*-:::::::::::::::::::::::::::+--++++++%--:::-+==::-*@@@@@@@@@@@@@ %*+=+%@@@@@@@@%==#--=#+++++++++++#*+#+=-----------------=:::::-+*+-::::::::::::::::::::::::::=--+++++*+--:::-=-=-::=@@@@@@@@@@@@@ @@@*+*#@@@@@@@@%-+*--+*#++++#*++++*#*++*%%##%=-----=--:--:::::-#*#-::::::::::::::::::::::::::=--+++++*--:::-=*--+::-*@@@@@@@@@@@@ @@@@@@@@@@#*+==-+=++++++*##***##*+***#%**+=--------:::::::::::--%+-:::::::::::::::::::::::::-=-=*++++%--:::-+*+=-+:-=@@@@@@@@@@@@ @@@@@@@@%%###%%%==#**++++++*####*#%#****%#+==----:::::::::::::::::::::::::::::::::::::::::::-+-=++++**--:::-***+--+--*@@@@@@@@@@@ %%%#***+*@#**++++*+#****+*+*+=++*****=*===--::::::::::::::::::::::::::::::::::::::::::::::::-=-=++++*=-::::-****=-=--=@@@@@@@@@@@ +==--------=*#*******##*#*#=-=+++++**--*+-::::::::::::::::::::::::::::::::::---=::::::::::::-=-=*+++%--::::-#*+++=-*-=%@@@@@@@@@@ --::::::::-============%+%+--+*++++**--+*%-::::::::::::::::::::::::::-----=#@%%-::::::::::::==-=*++#=--:::--#+++++===-+@@@@@@@@@@ -:::::--==-----------=%#==*--+*******--=**#+-::::::::::::::::::::--+#%%%#****#--:::::::::::-%+-=***#--::--=-*++++++-+-=@@@@@@@@@@ ----===-----------=-=*===-*--+*******--=****#-::::::::::::::::::-+@%#*++++=++-:::::::::::-=##+-=***+--:--=-=*++++++==+=%@@@@@@@@@ =++=----------============#--+*******--=****##+-::::::::::::::::::--=#*++**-::::::::::::-#++*+-=**#=-----*-+*+++++++=+=+@@@@@@@@@ ==-------=================#-=+*+*****--=*+**##*#=-::::::::::::::::::::--------::::::::-=#+++*+-=***-----=*-***+++++++=*=%%@@@@@%# =----================--===#-=********--=*+**%#***#=-:::::::::::::::::::=##**-::::::::-%+++++++-=+#=-----*+=%#**++++++=+-#======== --------=====-------------#-=********--=*+**%***+**#*=--::::::::::::::::---::::::::-+*++++++++--**-----=*==##**+++++*+=*----:::-- ==---------==========-----%-=+*******--+****%*++++*****##---:::::::::::::::::::::-=%++++++++++=-*-----=**==**#*++++++*=+-*-:::::- =============+====++#+====%--+******+--+*+**#*+++++****=---=#*=--:::::::::::::::-#+++++++++++*==*-----+**-=**%*+++++**+=**--::--- ======+*+++=++=======+#@*+#--+*****#=--+*+**#*++++++**#=----=#++*%+=---:::::::-**++++++++++++*=*-----=**+=***%**+++****=*==:::::: ===========+++=========+++#--=*****#=--+****#*+++++++*%=----==%*++++**#*-----**++++++++++++++*=*-----+**==%***#*+++****+=+*------ =============++++=========#--=******=--+****#*++++++++%==-=+#++#*++++++++++++++++++++++++++++#*=----=***==%#**#**++****+=%*=+%@@@ ===========+*#@%+=========#--=******---+***#**+++++++*#+#@*+++++%++++++++++++++++++++++++++++%+----=+***=+*+*%%*********=+=+=++++ ++*##*++**#@@@*+==========#--=*#**+=---****#**++*****%*#+++++++++#+++++++++++++++++++++++++++*=----=#**=-%++++**%#******==*#----- @@%%@@@@@@@@@#+=--===++#@#%---*#**=---=****%****#@%+++@++++++++++**+++++++++++++++++++++++++%=----=+***==#+++++++**%%***+=%*-:::: @@@%%%%@@@@@@+==-==+%%%%@@@=-=+%**=---=****%##**#*+++%+++++++++++*#+++++++++++++++++++++++++*=----=#**+=*++++++++++#++=#*+*==:::: @@@@%%%%%@@@*+==+*@@@@@@@**--=+%*+=---=****#***%*+++%++++++++++++*#++++++++++++++++++++++++%=----=****==@+++++++++#*====#++*#+=-- @@@@@@%%%%@@%###%@@@@@%=--=--=+%*=---=+***%##*%*+=+*+++++++++++++##++++++++++++++++++++++++*=---=+##*+==*+*++++++#*+*%%@@@@@@@%%@ @@@@@@@@@@@@@@@@@@@@@=-:::-=-=+%*=---=****%####++=+*#+++++++++++*#*+++++++++++++++++++++**%==---=*##*==#***+++++#*#@@@@@@@@@@@%%% @@@@@@@@@@@@@@@@@@@%=::.::-+-=+%+=---=****%##%++==++%*++++++++++*%*+++++++++++++++++++++*+#=---=+###+==%***++++#%@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@%@#-::.::-*#==**==--==***#*#%#++++++*#*++++++++++++++++++++++++++++++++***+=--==*###=-****+==#%@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@#-::::::-#%==#+==--==#**@+=*++++++++%****++++++++++++++++++++++++++++***#+=--=+###*--%=--==%@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@%%%%*#-::::::--+*+=*+=====+####==+=-=+++++*@%#**+++++++++++++++++++++++++++***@==-==####=-=---=#@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@%%#*+++*=-::::::-*+++=*======+###*===+:::-++++*#*#%****+++++++++*****+****++*****#====*###*--#-=%+@@@@@@@@@@@@@@@@@@@@@@@ @@@%%%%%*+====+*-:::--+--%=+#++======*##%+===*-::::-=++%****##****************************====####=-=#+=*@@@@@@@@@@@@@@@@@@@@@@@@ %%#*+++#+=====#---:---*--#++#*=======*##@+===*+---::::-+@*****%*****************##%@%#***+===*###*--=-=*@@@@@@@@@@@@@@@@@@@@@@@@@ ========*+===++-------*-=+++*#======+###%+++*#@@@#=-:::--%*****%#***********%##*******+=#===+####=--+=+@@@@@@@@@@@@@@@@@@@@@@@@@@ ============+#=-------#-=++++@======+##*#*#@@@@@@@*=::::--#+****%*********##********+===%===+####=-==+@@@@@@@@@@@@@@@@@@@@@@@@@@@ ==========+++*--------%==++++%=====+*###*#@@@@@@@@#=-::::--#+#***********@******#*===-==@=++####*--*+@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ===+++++****%=--------#==++++%=====+###%*#@@@@@@@@%+=-::----++**********#*****#*+====*#*%+++####=-=+%@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ===+++++++++#=-------=#++++++%=====+###@#%@@@@%@@@@@#=-------=#*###*******###++==+%+---=#++*###*=-**@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ====+++++++*+=-------=#%+*+++#+===++###@@@@@@@@@@@@@@+---------+#*########*+##*=-------=#++####+=+%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */

Compilation message (stderr)

molecules.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
molecules_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...