#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) {
ll xx = x, yy = y;
vector<pair<ll, int>> p;
for (int i = 0; i < w.size(); i++) p.pb({w[i], i});
sort(all(p), greater<pair<ll, int>>());
vector<int> res;
ll sx = 0;
for (int i = 0; i < p.size(); i++){
if (sx < xx){
sx += p[i].fi;
res.pb(p[i].se);
}
if (sx >= xx){
if (sx > yy){
sx -= p[i].fi;
res.pop_back();
}
else {
sort(all(res));
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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |