제출 #539357

#제출 시각아이디문제언어결과실행 시간메모리
539357beaconmcDetecting Molecules (IOI16_molecules)C++14
100 / 100
587 ms5384 KiB
/* .'.................',. ............'''',,'''',,'.. ......''';:cloodxxxxdolc;,''.. ......',;,:lddxkkOO000Okkxdc,.... .....';;;;:ldddxkkOO0K0Okkkxdc,... ....';::;:ldddxxkkkO000Okkkxdo:.... ...';;;:codddddxxxkkOO00Okkxxo:'... ██████╗ ███████╗ █████╗ ██████╗ ██████╗ ███╗ ██╗ ...';,,:cloooooddddddxxxddddddc'... ██╔══██╗██╔════╝██╔══██╗██╔════╝██╔═══██╗████╗ ██║ ..',,,'',;;:cclollcc;,''',;coo;.. ██████╔╝█████╗ ███████║██║ ██║ ██║██╔██╗ ██║ ..,,,''....',:oddl:,'..',,,:od:.'. ██╔══██╗██╔══╝ ██╔══██║██║ ██║ ██║██║╚██╗██║ ..';;'','....'cdkOx:'',,;clclodc,:, ██████╔╝███████╗██║ ██║╚██████╗╚██████╔╝██║ ╚████║ ..';;,,,,',,',cdkkxolccccloddooc;:; ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝ .';::cllc::,,cdxxdooollloddxxdlcoc. ________ ___ .';:clc:;;;,;codddooolc::cclooodkc. ███████╗██╗ ██╗███████╗███████╗██╗ ██╗ ██████╗ ██████╗ ██████╗ ███████╗ /_ __/ |/ / .';;;,,,,,,,;cooollloolc;,',:cc:,. ██╔════╝██║ ██║██╔════╝██╔════╝╚██╗ ██╔╝ ██╔════╝██╔═══██╗██╔══██╗██╔════╝ / / / /|_/ / .,,,'..',,,,,::::cccc:;''..;:,. ███████╗██║ ██║███████╗███████╗ ╚████╔╝ ██║ ██║ ██║██║ ██║█████╗ /_/ /_/ /_/ ';:;,..,;;;,;:ccllool;';;;::. ╚════██║██║ ██║╚════██║╚════██║ ╚██╔╝ ██║ ██║ ██║██║ ██║██╔══╝ .,:::,';oxxxxkkO00KOocclcc:. ███████║╚██████╔╝███████║███████║ ██║ ╚██████╗╚██████╔╝██████╔╝███████╗ .';::,',coxxkkkkxxo:cool;. ╚══════╝ ╚═════╝ ╚══════╝╚══════╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝ .,:;,'',:cccllodolodo:. ..''',;;;;::cllooooodddocc:;,.. ....'',;;'''',;::cclllloddddlclolcdxdl:,.. ..'',,'',;,,;;,,''';:ccloloodddol:::llldkkkkxxdl;. :,,,;,',;;,,;,'',,,,,:clooooool::clc:coxxxkkkkkkkx ''',,,',;;,,,'.',,,,'';:cccc:;,;cloollodxxkkkkkkkk */ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include "molecules.h" typedef long long lll; using namespace std; using namespace __gnu_pbds; #define FOR(i, x, y) for(int i=x; i<y; i++) #define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update> #define fast() ios_base::sync_with_stdio(false);cin.tie(NULL) vector<int> find_subset(int l, int u, vector<int> k){ vector<int> w; w = k; sort(w.begin(), w.end()); lll n = k.size(); lll ll = 0; lll rr = 0; lll cur = 0; while (ll<=rr){ if (cur<l){ if (rr>n) break; cur += w[rr]; rr++; }else if (cur>u){ cur -= w[ll]; ll ++; }else{ break; } } vector<int> ans; unordered_multiset<int> realsus; if (l<=cur && cur<=u){ FOR(i,ll,rr){ realsus.insert(w[i]); } } FOR(i,0,n){ if (realsus.count(k[i])){ ans.push_back(i); realsus.erase(realsus.find(k[i])); } } return ans; }
#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...