Submission #995718

#TimeUsernameProblemLanguageResultExecution timeMemory
995718kokoueDetecting Molecules (IOI16_molecules)C++14
9 / 100
1 ms348 KiB
#include<bits/stdc++.h> #define maxn 1000000 using namespace std; //set<long long> is; unordered_map<int,bool> is; unordered_map<long long,long long> idx; vector<int> find_subset(int l,int u,vector<int> w) { int n=w.size(); is[0]=1; idx[0]=0; int sum=0; bool fl=0; int mx=0; vector<pair<int,int>> a; for(int i=0;i<n;i++) a.push_back({w[i],i}); sort(a.begin(),a.end()); vector<int> res; int ll=0,r=0; for(int i=0;i<n;i++) { sum+=a[i].first; while(sum>u) { sum-=a[ll].first; ll++; } if(l<=sum && sum<=u) { for(int j=ll;j<=i;j++) res.push_back(j); return res; } } return res; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:13:10: warning: unused variable 'fl' [-Wunused-variable]
   13 |     bool fl=0;
      |          ^~
molecules.cpp:14:9: warning: unused variable 'mx' [-Wunused-variable]
   14 |     int mx=0;
      |         ^~
molecules.cpp:19:14: warning: unused variable 'r' [-Wunused-variable]
   19 |     int ll=0,r=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...