Submission #1036598

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10365982024-07-27 14:39:54adkjtDetecting Molecules (IOI16_molecules)C++14
100 / 100
37 ms8792 KiB
#include "molecules.h"
#include<bits/stdc++.h>
using namespace std;
//#define ll long long;
#define f first
#define s second
long long mn[222222],mx[222222];
pair<int,int> s[222222];
deque<int> dq;
vector<int> ans;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
int sz=w.size();
for(int i=0;i<sz;i++) s[i].f=w[i],s[i].s=i;
sort(s,s+sz);
mn[0]=s[0].f;
mx[sz-1]=s[sz-1].f;
for(int i=1;i<sz;i++)
{
mn[i]=mn[i-1]+s[i].f;
}
for(int i=sz-2;i>=0;i--)
mx[i]=mx[i+1]+s[i].f;
//for(int i=0;i<sz;i++) cout<<mn[i]<<' '<<mx[i]<<'\n';
reverse(mx,mx+sz);
//for(int i=0;i<sz;i++) cout<<mn[i]<<' '<<mx[i]<<'\n';
long long sum=0,i=0;
while(sum>u||sum<l)
{
//cout<<sum<<' '<<i<<'\n';
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...