제출 #501598

#제출 시각아이디문제언어결과실행 시간메모리
501598dnauxDetecting Molecules (IOI16_molecules)C++17
0 / 100
1 ms204 KiB
#include <bits/stdc++.h> #include "molecules.h" #define endline "\n" #define pb push_back #define mp make_pair #define st first #define nd second #define lsb(i) i&(-i) #define sz(i) (int)i.size() typedef long long ll; using namespace std; const ll INF = 1e18L; constexpr int mod = int(1e9) + 7; ll t=1, n, m, k, q, s, cases = 0, timee = 0; vector<int> find_subset(int l, int u, vector<int> ar){ n = sz(ar); vector<pair<int,int>> bruhar; for(int i = 0; i < n; i++){ bruhar.pb(mp(ar[i],i + 1)); } sort(bruhar.begin(),bruhar.end()); vector<int> ans; ll sum = bruhar[0].st, i = 0, j = 0; for(;i < n or j < n;){ if(sum >= l and sum <= u){ for(int k = i; k <= j; k++)ans.pb(bruhar[k].nd); return ans; } else if(i >= n){ j++;sum += bruhar[j].st; } else if(j >= n){ sum -= bruhar[i].st; i++; } else if(sum < l){ j++; sum += bruhar[j].st; } else if(sum > u){ sum -= bruhar[i].st; 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...