Submission #487949

#TimeUsernameProblemLanguageResultExecution timeMemory
487949BY_KUTBILIMDetecting Molecules (IOI16_molecules)C++17
0 / 100
0 ms204 KiB
/* @AUTHOR: BY_KUTBILIM FILE CREATED: 16.11.2021 17:46:37 (GMT+6) */ #include "molecules.h" #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) if(st <= sum and sum <= dr){ vector<int> ans; while(!q.empty()){ ans.pb(q.front().se+1); 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...