#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));
vector<int> res;
int l = 0;
ll sx = 0;
for (int i = 0; i < p.size(); i++){
sx += p[i].fi;
if (sx > yy){
while (l < i){
sx -= p[l].fi;
l++;
if (sx <= yy) break;
}
if (sx >= xx){
for (int j = l; j <= i; j++){
res.pb(p[j].se);
}
sort(all(res));
return res;
}
}
}
return {};
}
/*
++++++***#@*--------------------------=---------------------------------------=----------------==----=--%+++++++++*#***++++++++*#
***%@@@%##+---------------------------#----------------------------------------+=-=-------------=+----+--%*+++++++++++++++++++**#
###******+-:-------------------------=----------------------------=--------------+-*-------------=+--::=-=*#+++++++++++++++++**##
++++++++=-:-----------------
---------#-------------------------------+------------+=*--------------+--::=-+++++++++++++++++++*#%%
+++++++*-:--------------------------=+---------------------------------=+----------=**-------------=+--::=-+++++++++++++++++**#%#
++****%-:---------------------------=-------------------------------------+=----::---**--------=----==---:-#++++++++++++++**#%#*+
++***%--:-+=------------------------+---------------------------------------==---::---=+---::---+----=---::-=*++++++++****#%%%*==
++**#=-:--+---==--------------------+-:----------------------------------------=---:::--+----:---+----*--:::::-+**++**#%%%%##*+==
+*+*#-:--=----+----------------------:-------------------:--:----------:--+------*---:::-+---::--=+----=--:::::::--=+*#*#%%%%%##+
***#-::--*---=*-------*-------------:::-------------------::-::::::::::::--#=--:--+*=--::-==-:::--++---+=--::::::----=*%@@@@@@@%%
**+#-:---+---++------==--------------::------------------:--:::::--:::::::--+=-::-=++*--::--=-::--++=---++--:::::::=%@@@@@@@#*+++
**#=::--%=---*+------%-----=---------+:-----:-------------:::--::-----::::--*++-::-=+++*--::-=-::-=++---##++--:::::::--=+++++*===
**#-:--=@=--=*+-----++----*----------=------:----------==--::-=--::-=--::::-===+-:--+#+++*--:-=::-=++=---++#++=---:::::::---++===
**#-:-=%@=*-+*+----=#=----=-----------=------:-----::---*+--:--*--::-+=-:::--=-=+---=++++++=----:--+++---#++++*#++=========*++===
*#+-:-=@@===**+----+#=---+------------*------=-----:::--=*+--:--#--:--+=---+*#*++*--=*#*#*+*+--+---+++=--#==============++*++====
*#=::-+#@+==***---=*%----#-----+-------#------=---:::::--=**=---=*=---#*#=---+:::=+--=#-=++*=+--=--++++--++=======+++++%*++++====
%#=::-##@#==***=--=*#----*-----+=------%---:--=---:-::::--+**+---+++#+=#+=--:=::::==--*--+++=-+=+--++++--++==+%##%%@%**%+++===+++
@%---=@*@#==***=--=*#----+-----+#--::--%*--::--+--:::::::--++#*---#=+--=**---=:::::+--#::-%++--+===++++--*+===+%@@@@*++++++=+++++
*#---=%#@#=+***+--=*#----*--:--=#---:--@*=-:::--*--:::::::--++*+-==-==--+#=-+-::.::-*-%:::-*+---*+=+*++--%*+==++**%#+++++++++++++
+#=--=***%=+++**=-=*#=--+*-----=#*--:--#+#------+*--:::::::--+*++--*-*--*-*-=:::.:::*-=::::#*-::=+++*#+-=*--=#@@@%%**++++++++++++
***--+*%@@=++++*+==**=--**=--+-=+%=----++=+=+******---::::::--+#=+==--+-*-%*+=----=+#*=-::--%-::-=+*+*+=**::-#@@**#@#+++++++++++#
**#--+**%@=++++++==***--#*=--*+==##=--=*#===----=*=#-::::::::--+#=++=--#++#**@@@%%%%@@@@@+==*-::-++*+*+#+=::-#@#+++%@++++++++++++
@##=-++**@==++++++=++%==##+--=%==**#*=--%--==----+=-=-:--:::::-=**=+*--*#+@@%=--::-=----=*@*=-:-=+#++*#++-:::*==-----------------
@@@*=+@**#+=+#+++++++*==**#=--*#+#%=+---==::+-----#+--*:----:::--*%-#::-##=--::::::::::::--+=--=+*+++#++*-:::#==--------------==-
@@@@++@###+=+#*+++++++%==*#+--*#%=*+--*--#:::+==--=+::::#--+---:---*=::::::::::::::::::-:-*%=-+#==++++++#-::-#*****+======+**+===
%%%%*=@#*+#=++#*+++++++*=#+#=-#+=*=#-::*-=-:::+=+--+-::::=*-%+-------=*=::::::::-:-:-:--+#*=+#+--=+++++++-::-#++====----------===
====*=#+++#==+#*+++++++++#++*==#=-++=:::-*+---*#+%==#=#::::-**=++--=%#*+-:::-:--:---:--==#+*-+---=+++++*=-:::*-**+==---------=++*
====+%*#@@@*=++#**+++++++**++*=*=---%-:::-+%#@@@@%%*=#-::::::-+%=--=====-:--:--:---:-:==--:::=:--++++++#--:::*--++======+**#*==--
++++*%%@@#**-=+#%*+++++++*@*++*+*-:::*-:-+@@%*=---=+-+%-::::::::--*+-::::::--::::::::::::::::+---++++++#-::::*::-*+++**#@@@@#+++=
@@@@@%@%##*=+-=*#%*++++++++%*++##-::::-+#@*--::::::::::::::::::::::::::::-:::::::::::::::::::+--=+++++*+-:::-+-::-#%@@@@@@@@@@@@@
@@@@@@@@@%%##==+#+%*++++++++****#*-:::=@@=-::::::::::::::::::::::::::::::::::::::::::::::::::+--=+++++*--:::-+=::-+@@@@@@@@@@@@@@
*+*%@@@@@@@@@@==*%++*++++++++++*#*%---#@=-:.:::--::---=::-::::-=*-:::::::::::::::::::::::::::+--++++++%--:::-+==::-*@@@@@@@@@@@@@
%*+=+%@@@@@@@@%==#--=#+++++++++++#*+#+=-----------------=:::::-+*+-::::::::::::::::::::::::::=--+++++*+--:::-=-=-::=@@@@@@@@@@@@@
@@@*+*#@@@@@@@@%-+*--+*#++++#*++++*#*++*%%##%=-----=--:--:::::-#*#-::::::::::::::::::::::::::=--+++++*--:::-=*--+::-*@@@@@@@@@@@@
@@@@@@@@@@#*+==-+=++++++*##***##*+***#%**+=--------:::::::::::--%+-:::::::::::::::::::::::::-=-=*++++%--:::-+*+=-+:-=@@@@@@@@@@@@
@@@@@@@@%%###%%%==#**++++++*####*#%#****%#+==----:::::::::::::::::::::::::::::::::::::::::::-+-=++++**--:::-***+--+--*@@@@@@@@@@@
%%%#***+*@#**++++*+#****+*+*+=++*****=*===--::::::::::::::::::::::::::::::::::::::::::::::::-=-=++++*=-::::-****=-=--=@@@@@@@@@@@
+==--------=*#*******##*#*#=-=+++++**--*+-::::::::::::::::::::::::::::::::::---=::::::::::::-=-=*+++%--::::-#*+++=-*-=%@@@@@@@@@@
--::::::::-============%+%+--+*++++**--+*%-::::::::::::::::::::::::::-----=#@%%-::::::::::::==-=*++#=--:::--#+++++===-+@@@@@@@@@@
-:::::--==-----------=%#==*--+*******--=**#+-::::::::::::::::::::--+#%%%#****#--:::::::::::-%+-=***#--::--=-*++++++-+-=@@@@@@@@@@
----===-----------=-=*===-*--+*******--=****#-::::::::::::::::::-+@%#*++++=++-:::::::::::-=##+-=***+--:--=-=*++++++==+=%@@@@@@@@@
=++=----------============#--+*******--=****##+-::::::::::::::::::--=#*++**-::::::::::::-#++*+-=**#=-----*-+*+++++++=+=+@@@@@@@@@
==-------=================#-=+*+*****--=*+**##*#=-::::::::::::::::::::--------::::::::-=#+++*+-=***-----=*-***+++++++=*=%%@@@@@%#
=----================--===#-=********--=*+**%#***#=-:::::::::::::::::::=##**-::::::::-%+++++++-=+#=-----*+=%#**++++++=+-#========
--------=====-------------#-=********--=*+**%***+**#*=--::::::::::::::::---::::::::-+*++++++++--**-----=*==##**+++++*+=*----:::--
==---------==========-----%-=+*******--+****%*++++*****##---:::::::::::::::::::::-=%++++++++++=-*-----=**==**#*++++++*=+-*-:::::-
=============+====++#+====%--+******+--+*+**#*+++++****=---=#*=--:::::::::::::::-#+++++++++++*==*-----+**-=**%*+++++**+=**--::---
======+*+++=++=======+#@*+#--+*****#=--+*+**#*++++++**#=----=#++*%+=---:::::::-**++++++++++++*=*-----=**+=***%**+++****=*==::::::
===========+++=========+++#--=*****#=--+****#*+++++++*%=----==%*++++**#*-----**++++++++++++++*=*-----+**==%***#*+++****+=+*------
=============++++=========#--=******=--+****#*++++++++%==-=+#++#*++++++++++++++++++++++++++++#*=----=***==%#**#**++****+=%*=+%@@@
===========+*#@%+=========#--=******---+***#**+++++++*#+#@*+++++%++++++++++++++++++++++++++++%+----=+***=+*+*%%*********=+=+=++++
++*##*++**#@@@*+==========#--=*#**+=---****#**++*****%*#+++++++++#+++++++++++++++++++++++++++*=----=#**=-%++++**%#******==*#-----
@@%%@@@@@@@@@#+=--===++#@#%---*#**=---=****%****#@%+++@++++++++++**+++++++++++++++++++++++++%=----=+***==#+++++++**%%***+=%*-::::
@@@%%%%@@@@@@+==-==+%%%%@@@=-=+%**=---=****%##**#*+++%+++++++++++*#+++++++++++++++++++++++++*=----=#**+=*++++++++++#++=#*+*==::::
@@@@%%%%%@@@*+==+*@@@@@@@**--=+%*+=---=****#***%*+++%++++++++++++*#++++++++++++++++++++++++%=----=****==@+++++++++#*====#++*#+=--
@@@@@@%%%%@@%###%@@@@@%=--=--=+%*=---=+***%##*%*+=+*+++++++++++++##++++++++++++++++++++++++*=---=+##*+==*+*++++++#*+*%%@@@@@@@%%@
@@@@@@@@@@@@@@@@@@@@@=-:::-=-=+%*=---=****%####++=+*#+++++++++++*#*+++++++++++++++++++++**%==---=*##*==#***+++++#*#@@@@@@@@@@@%%%
@@@@@@@@@@@@@@@@@@@%=::.::-+-=+%+=---=****%##%++==++%*++++++++++*%*+++++++++++++++++++++*+#=---=+###+==%***++++#%@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@%@#-::.::-*#==**==--==***#*#%#++++++*#*++++++++++++++++++++++++++++++++***+=--==*###=-****+==#%@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@#-::::::-#%==#+==--==#**@+=*++++++++%****++++++++++++++++++++++++++++***#+=--=+###*--%=--==%@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@%%%%*#-::::::--+*+=*+=====+####==+=-=+++++*@%#**+++++++++++++++++++++++++++***@==-==####=-=---=#@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@%%#*+++*=-::::::-*+++=*======+###*===+:::-++++*#*#%****+++++++++*****+****++*****#====*###*--#-=%+@@@@@@@@@@@@@@@@@@@@@@@
@@@%%%%%*+====+*-:::--+--%=+#++======*##%+===*-::::-=++%****##****************************====####=-=#+=*@@@@@@@@@@@@@@@@@@@@@@@@
%%#*+++#+=====#---:---*--#++#*=======*##@+===*+---::::-+@*****%*****************##%@%#***+===*###*--=-=*@@@@@@@@@@@@@@@@@@@@@@@@@
========*+===++-------*-=+++*#======+###%+++*#@@@#=-:::--%*****%#***********%##*******+=#===+####=--+=+@@@@@@@@@@@@@@@@@@@@@@@@@@
============+#=-------#-=++++@======+##*#*#@@@@@@@*=::::--#+****%*********##********+===%===+####=-==+@@@@@@@@@@@@@@@@@@@@@@@@@@@
==========+++*--------%==++++%=====+*###*#@@@@@@@@#=-::::--#+#***********@******#*===-==@=++####*--*+@@@@@@@@@@@@@@@@@@@@@@@@@@@@
===+++++****%=--------#==++++%=====+###%*#@@@@@@@@%+=-::----++**********#*****#*+====*#*%+++####=-=+%@@@@@@@@@@@@@@@@@@@@@@@@@@@@
===+++++++++#=-------=#++++++%=====+###@#%@@@@%@@@@@#=-------=#*###*******###++==+%+---=#++*###*=-**@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
====+++++++*+=-------=#%+*+++#+===++###@@@@@@@@@@@@@@+---------+#*########*+##*=-------=#++####+=+%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
*/
컴파일 시 표준 에러 (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... |