Submission #98577

# Submission time Handle Problem Language Result Execution time Memory
98577 2019-02-24T14:38:02 Z MvC Detecting Molecules (IOI16_molecules) C++11
0 / 100
5 ms 2048 KB
#pragma GCC optimize("O3")
#include "molecules.h"
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long long ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<61);
const int inf=(1<<30);
const int nmax=2e5+50;
const int mod=1e9+7;
using namespace std;
vector<int> find_subset(int l,int u,vector<int>w)
{
	int n=w.size(),i,j=1,s=0;
	int t=n;
	vector<int>ans;
	pair<int,int>x[nmax];
	for(i=0;i<n;i++)x[i+1]=make_pair(w[i],i);
	sort(x+1,x+n+1);
	for(i=1;i<=n;i++)
	{
		s+=x[i].fr;
		if(s>=l && s<=u)break;
		else if(s>u)
		{
			s-=x[i].fr;
			while(j<i)
			{
				s-=x[j].fr;
				s+=x[t].fr;
				j++,t--;
				if(s>=l && s<=u)break;
			}
		}
	}
	for(;j<i;j++)ans.pb(x[j].sc);
	for(t++;t<=n;t++)ans.pb(x[t].sc);
	return ans;
}
/*int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	
    return 0;
}*/
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 2048 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 1920 KB item #10 is taken twice
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 2048 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 2048 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 2048 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 2048 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -