Submission #98579

# Submission time Handle Problem Language Result Execution time Memory
98579 2019-02-24T14:44:45 Z MvC Detecting Molecules (IOI16_molecules) C++11
0 / 100
3 ms 1920 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(n);
	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)
		{
			for(j=1;j<=i;j++)ans.pb(x[j].sc);
			return ans;
		}
		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;
				if(j==i)return vector<int>();
			}
		}
	}
	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 3 ms 1920 KB Integer 2 violates the range [0, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 1920 KB Integer 24 violates the range [0, 12]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 1920 KB Integer 2 violates the range [0, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 1920 KB Integer 2 violates the range [0, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 1920 KB Integer 2 violates the range [0, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 1920 KB Integer 2 violates the range [0, 1]
2 Halted 0 ms 0 KB -