제출 #1000490

#제출 시각아이디문제언어결과실행 시간메모리
1000490Joon_Yorigami9월 (APIO24_september)C++17
100 / 100
280 ms35948 KiB
/* .:-=++***#***+=:. .:-==+**##**%########***#####*=:. .-+#%%#*****############**#******#####+=: .-*%#####********###########*********#######*+-: :+#######**********########*****+********##########+-. :+##########**###******##********************###########+: :+##########*****#*******###**********************###***####*: .=###########***###*******#***************************#****#####*: :*#################******************************************######= -###################***************+****************************#####*: .=###################******************************************#****#####+. :*###################*******************************+************#*****#####: =#############**######*****#*******************++***++++++***************#####= .*###########******####*****#************+++*+**+++***++++++++***#**********#####+ -############********###*****%*+****+++++++++++++++++***++++++++***#*****#****#####* =############********###+++++##++++++++++++++++*++++++****++++******##*+++*#****#####*. .+#*##########*********###+++++%*++==++++++++++++*+++++*#************#*##*+++##****#####*. .*#=-##########********###*++++*%*+++++++++++++*****+******#***********#*##*+++####*######*. .:-: .*#: *#########*********###+++++##****++*******************#*#**********##*#*****####*#%###%*. .--:++=+. .**. ##########********##*#++***%#****+*************=#*****#*#**********##*##*##*####**#%###%*: :++===== .**. -###########******##*##+****%#*****#************-********#**********#***%####*###***#%######=: .-=++= =*. +############****###*##*****%#*****%####*####**#:=#***#**#**********#=##*###**####***#%########+: . .#. .####################*##*****%#####*%#****##****#.:#***#*#**********#%:##*+##***%###***############+: -- -###################**#*****####****##****##*****..#*****#**********#*.*#+ +##**#####***##############+-. -=+++-. = +###################**#*****###**********#*#***#: .***#*#***********#:.*#- :**#*######***#######%%%####%%#=: .++====++ = ####################**##*****###***#+****#=#**** .+*###************+ ## +***######****##########+--+#%%%%+: .---:=+======+: +. ##################%#***#*****####****#**#+-####. .+###***##*******# .#: :***########***##%%%####%#=. .:=*%% ---==++=======+= -= .%#################%****#*****######-#*##*.=%#*. +=---:::.......: =: =**#########***#%%%%%%%%%%%=. .- :-:===========+= .#. :%################%%****#*****#####= :-+***#*=. .*#########%%#**#*=%%%%%%%%%%=. .---=========+= :*. -#################%%****#*****%#+-.-*#%%%@###*= +##########%%%***:+-#%%%#####*: .:=++++====+- =*.=###%############%@%****#*****#. =###%%%@@@+ ###########%%%%#*#: -*########= ..:::::-. +*+###%####%######%%+******#****#=##= -@@@@@@@+ =*###########%%%%##+ :*#######+ =%##+%####%######%+.******#*****%%#-:+@@@@%-=* +..###########%##%%%*. -####### %##=#####%###%%#%:=******#*****%*.**##*+=: . -+**####*=: - .=###############%%*: .+##### .%###%########%%%%:.#*****##*****= .+: . :-::.:--=++- : .-*##################+: :#### :##.*###########%@# #************+ .:.-==-- . +**###+*##############*: .*## -%- ############%@@-#*###*#=##***#. :. =*++*#**++*##############*- .## =# ############@@@######*#:###*##= :..+*++++***+++++*##############=.+# +: ###########%@%%%%######.=###### .=+#+++++++***+++++****############## .+ *##########%%%%%%######::######= =+++#*+++++++*#+++++******########### +: =%#%######%%%##%@######:-+######. .:------== :*++++**+++++++*#*+++++********####### -* :%%%%#####%%%##%%%#####***######* -=--------=: -*+++++++*++++++++*#**+++*=:=******+==* .*+ +%%%%###%%####%%%#####**+#######= -........:=: -++++++++++*#**##***+******++- .-******=. -*= *%%%%##%%%%%%%#%#####**++#######. :.........- .=#%%%######%##########%#+*******. .-++++*+ -*+ .*%%%%#%%#######%#####*++++######*: ......... :=#%@@%%%%%%#################*++*****=. .-++++ :**. :###%%%#%%########%####*++++*#######=-:.. -+#%%%###########################++++****#=. .-++ -*+ .######%%%%#########%###@@@%%%%######+...:----:. :*%################################%*+++++*+###- .+ :*+.=########%%%%###########%%%%%%%%######-........:------::.+%%%%%###############%#############%*+++++*.:*##+. . -+####****##%%%%%%%%###%########%%@%#####:.......:::::::...=@@%%%@###############%############%*+++++*. =##+ +#*##*****####%%%%##%%%%#########%@%#####:.....-:....:..::=*=++++############################%#*+++++ -##. =%**********#######%%###############%*#####=...=. . :-=-: .###############%#******####%#####+= +* *#************#############%%#######**+*%####-.- .-:=##############%*********##%#######=: .+. *#****************##**######%%%###*: ::*#####: -:: .-+####%%%####%*********#%##########*-: =#***********************######%*- .--:=:. =. :--: .-=*###%###*********#######*#######+- .#**************************###= .:. ::... .=. +***#%##*******#########***#######+: =##**************************: :-:--. .. .+..... + =******#%#####%##########***#####**# ####**********************+. . :#########+-=:.... -: +***********##%%#***######****##**** .#%####******************- *##########*:....... ...:. #**************##*********###*##**** :#%@%%%###************* =#*******####+....... :-. *#***************%************#%#**** .#**###%%%%%######****#. =#***********#=....:-. :*#****************##*************####* *#**#****#####%%%%##### =#*************+=: .=-::..:-*#*****************##*****************## -#***#*******######%%%%= :=*#**********: ... ##*##%##*******************#******************** .%*****#*********######%. ....:-=*- :++: =#****##%####*************###******************** :. +#*****#**********####%+ ..-*#***#+=##*******##%%###********####********************* .:-:. .%#*****#**********#%%%* :=+**##########******###********#%%%%%%##****###*********************** -- =%#******#*********@#%%-. :#%%%%%%%%%%%%%%###*****###*****#%%##%%%#%@#####************************* =-. .=. ##*******#********#%#**###*+=-:.: -######%##%###%####%%%%%##########%####%%%%##%*************####************ ==== .= :%#*******#********%%***************++#%%#%#######%###%#######%%%%%%%########%%%%####%#************####*********** ==== -: *%#*******#********@#********************#%#######%###%###########%%%%%#####%%%#######%%#**********#####********** :+=+. = .%###*******#******#%#*******************#%#############%##############%%%##%######***####%%#*******######********* */ #include <bits/stdc++.h> using namespace std; int solve(int N, int M, vector<int> F, vector<vector<int>> S) { deque<int> toprocess; unordered_set<int> globalseen = {0}; vector<unordered_set<int>> seen = {{},{},{},{},{}}; vector<int> processed = {1,1,1,1,1}; vector<int> tempchildren; for(int i=0; i<N; i++) { tempchildren.push_back(0); } for(int i=1; i<N; i++) { tempchildren[F[i]]+=1; } vector<vector<int>> children; for(int i=0; i<M; i++) { vector<int> temparr; temparr = tempchildren; children.push_back(temparr); } int ans = 0; for(int j=0; j<(N-1); j++) { bool check = true; for(int i=0; i<M; i++) { //i int num = S[i][j]; deque<int>().swap(toprocess); globalseen.insert(num); seen[i].insert(num); toprocess.push_back(num); while(toprocess.size()) { num = toprocess[0]; toprocess.pop_front(); if(children[i][num] == 0) { children[i][F[num]] -=1 ; processed[i] += 1; if(children[i][F[num]] == 0 && seen[i].find(F[num])!=seen[i].end()) { toprocess.push_back(F[num]); } } } check &= (processed[i]==globalseen.size()); } if(check) { ans++; } } return ans; }; /* int main() { cout << solve(3, 1, {-1, 0, 0}, {{1, 2}}) << endl; cout << solve(5, 2, {-1, 0, 0, 1, 1}, {{1, 2, 3, 4}, {4, 1, 2, 3}}) << endl; return 0; } */

컴파일 시 표준 에러 (stderr) 메시지

september.cpp: In function 'int solve(int, int, std::vector<int>, std::vector<std::vector<int> >)':
september.cpp:123:36: warning: comparison of integer expressions of different signedness: '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and 'std::unordered_set<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  123 |              check &= (processed[i]==globalseen.size());
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...