Submission #487960

#TimeUsernameProblemLanguageResultExecution timeMemory
487960BY_KUTBILIMDetecting Molecules (IOI16_molecules)C++17
69 / 100
40 ms4968 KiB
/* @AUTHOR: BY_KUTBILIM FILE CREATED: 16.11.2021 17:46:37 (GMT+6) */ #include <bits/stdc++.h> using namespace std; #define endl '\n' #define sz(x) int((x).size()) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define fi first #define se second #define pb push_back using ll = long long; using pii = pair<int, int>; vector<int> find_subset(int st, int dr, vector<int> w){ int n = sz(w); queue<pair<int,int>> q; vector<pair<int,int>> v; for(int i = 0; i < n; i++){ v.pb({w[i], i}); } sort(all(v)); int sum = 0; for(int i = 0; i < n; i++){ q.push(v[i]); sum += v[i].fi; while(sum > dr and !q.empty()){ sum -= q.front().fi; q.pop(); } if(st <= sum and sum <= dr){ vector<int> ans; while(!q.empty()){ ans.pb(q.front().se); q.pop(); } return ans; } } return vector<int>(0); }
#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...