Submission #573920

#TimeUsernameProblemLanguageResultExecution timeMemory
573920OrazBDetecting Molecules (IOI16_molecules)C++14
0 / 100
1 ms312 KiB
#include <iostream> #include <algorithm> #include <math.h> #include <vector> #include <map> #include <set> #include <bitset> #include <queue> #define ll long long int #define pb push_back #define sz size() #define N 100001 #define ff first #define ss second using namespace std; ll l1, r1, md, jogi, jogj, p[N], x = 0; map <int,int> m; vector <int> out; vector<int> find_subset(int l, int u, vector<int> w){ int n = w.sz; sort(w.begin(), w.end()); for(int i = 0; i < n; i++){ m[w[i]] = i; p[i] = p[i-1] + w[i]; } for(int i = 0; i < n; i++){ l1 = i+1, r1 = n-1, md = 0, jogi = -1, jogj = -1; while(l1 <= r1){ md = (l1+r1)/2; if(p[md] - p[i] >= l and p[md] - p[i] <= u){ jogi = i+1; jogj = md; break; } else if(p[md] - p[i] < l){ l1 = md+1; } else if(p[md] - p[i] > u){ r1 = md-1; } } if(jogi != -1) break; } if(jogi == -1){ return out; } else{ for(int i = jogi; i <= jogj; i++){ out.pb(m[w[i]]); } sort(out.begin(), out.end()); return out; } }
#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...