Submission #240213

#TimeUsernameProblemLanguageResultExecution timeMemory
240213tleontest1Detecting Molecules (IOI16_molecules)C++14
0 / 100
5 ms384 KiB
#include "molecules.h" #pragma GCC optimize ("O3") #pragma GCC target ("sse4") #pragma GCC optimize ("unroll-loops") #pragma GCC target ("avx2") #include <bits/stdc++.h> using namespace std; typedef long long lo; typedef pair< lo,lo > PII; #define fi first #define se second #define mp make_pair #define endl "\n" #define pb push_back #define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define FOR for(int i=1;i<=n;i++) #define mid ((start+end)/2) #define ort ((bas+son)/2) const int inf = 1000000000; const lo KOK = 100000; const lo LOG = 30; const lo li = 500005; const lo mod = 1000000007; int n,m,b[li],a[li],k,flag,t; int cev; string s; vector<int> vv,vec; set<PII> v; std::vector<int> find_subset(int l, int u, std::vector<int> w) { for(int i=0;i<(int)w.size();i++){ v.insert({w[i],i}); } while(l>0){ auto it=v.upper_bound({l,inf}); PII p1=*it; //~ cout<<p1.fi<<endl;; if(p1.fi>=l && p1.se<=u){ vv.pb(p1.se); u-=p1.fi; l-=p1.fi; break; } if(it==v.begin()){ vv=vec; //~ l-=*it; //~ u-=*it; break; } it--; PII p=*it; vv.pb(p.se); l-=p.fi; u-=p.fi; v.erase(it); //~ cout<<l<<endl; } if(u<0 || l>0)vv=vec; return vv; }
#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...