Submission #136798

#TimeUsernameProblemLanguageResultExecution timeMemory
136798BoxworldDetecting Molecules (IOI16_molecules)C++14
100 / 100
67 ms7160 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; typedef vector<int> vec; struct node{int val,id;}a[200100]; bool cmp(node x,node y){return x.val<y.val;} long long s[200100]; vec find_subset(int l,int u,vec w) { int n=w.size(); for (int i=1;i<=n;i++){ a[i].val=w[i-1];a[i].id=i-1; } sort(a+1,a+n+1,cmp); s[0]=0; for (int i=1;i<=n;i++)s[i]=s[i-1]+a[i].val; int i=1,j=1; while(i<=j&&j<=n){ if (s[j]-s[i-1]<l)j++; else if (s[j]-s[i-1]>u)i++; else{ vector<int> ans; for (int k=i;k<=j;k++)ans.push_back(a[k].id); return ans; } } vector<int> S; return S; }
#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...