답안 #169515

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
169515 2019-12-20T18:38:59 Z anubhavdhar Detecting Molecules (IOI16_molecules) C++14
9 / 100
2 ms 424 KB
#include<bits/stdc++.h>
 
#define ll long long int 
#define FOR(i,N) for(i=0;i<N;i++)
#define FORe(i,N) for(i=1;i<=N;i++)
#define FORr(i,a,b) for(i=a;i<b;i++)
#define ii pair<ll,ll>
#define vi vector<ll> 
#define vii vector<ii>
#define ff first
#define ss second 
#define mp make_pair 
#define pb push_back
 
using namespace std;
 
#include "molecules.h"
/*
const ll MAXN = 1e5+5;
const ll INF = 1e17 + 9;
const ll MOD = 1e9 + 7;
const ll INT_BITS = 31;
const ll LOGN = 17;
*/

#define MAXN 200005

vector<int> find_subset(int l,int u,vector<int>w) 
{
	//cout<<"p\n";
	ll N,i,j,k;
	//cin>>N;
	N = w.size();
	sort(w.begin(),w.end());
	ll sum = 0;
	vector<int> v;
	//cout<<"l = "<<l<<" and r = "<<u<<" and N = "<<N<<" after sorting\n";
	FOR(i,N)
	{
		//cout<<w[i]<<" ";
		sum += w[i];
	}
	if(sum < l)
		return v;
	//cout<<endl;
	sum = w[0];
	i = 0;
	j = 0;
	while(j < N and i < N and i<=j)
	{
		//cout<<"entering with i = "<<i<<" and j = "<<j<<" and sum = "<<sum<<endl;
		if(sum > u)
		{
			i++;
			sum -= w[i-1];
			//cout<<"reducing sum to "<<sum<<endl;
		}
		else if(sum < l)
		{
			j++;
          	if (j == N)
              return v;
			sum += w[j];
			//cout<<"increasing sum to "<<sum<<endl;
		}
		//cout<<"after manupulation sum = "<<sum<<endl;
		if (sum >= l and sum <= u)
		{
			//cout<<"got something\n";
			for(k = i;k <= j;k++)
				v.pb(k);
			break;
		}
	}
	return v;
}

/*
int main()
{
	ll i,n,u,l;
	cin>>n>>l>>u;
	vector<int> w(n);
	FOR(i,n)
		cin>>w[i];
	//cout<<"input taken\n";
	vector<int> v;
	v = find_subset(l,u,w);
	FOR(i,v.size())
		cout<<v[i]<<endl;
	return 0;
}
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 256 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Correct 2 ms 376 KB OK (n = 2, answer = YES)
5 Correct 2 ms 380 KB OK (n = 2, answer = YES)
6 Correct 2 ms 256 KB OK (n = 3, answer = YES)
7 Correct 2 ms 376 KB OK (n = 3, answer = YES)
8 Correct 2 ms 376 KB OK (n = 3, answer = YES)
9 Correct 2 ms 376 KB OK (n = 3, answer = YES)
10 Correct 2 ms 376 KB OK (n = 3, answer = YES)
11 Correct 2 ms 376 KB OK (n = 3, answer = YES)
12 Correct 2 ms 376 KB OK (n = 3, answer = YES)
13 Correct 2 ms 424 KB OK (n = 3, answer = NO)
14 Correct 2 ms 376 KB OK (n = 3, answer = YES)
15 Correct 2 ms 376 KB OK (n = 3, answer = YES)
16 Correct 2 ms 376 KB OK (n = 3, answer = NO)
17 Correct 2 ms 376 KB OK (n = 3, answer = NO)
18 Correct 2 ms 376 KB OK (n = 100, answer = NO)
19 Correct 2 ms 256 KB OK (n = 100, answer = YES)
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 292 KB OK (n = 12, answer = YES)
2 Correct 2 ms 256 KB OK (n = 12, answer = YES)
3 Correct 2 ms 256 KB OK (n = 12, answer = NO)
4 Correct 2 ms 256 KB OK (n = 12, answer = NO)
5 Correct 2 ms 376 KB OK (n = 12, answer = YES)
6 Correct 2 ms 376 KB OK (n = 12, answer = YES)
7 Correct 2 ms 376 KB OK (n = 12, answer = YES)
8 Correct 2 ms 380 KB OK (n = 12, answer = YES)
9 Correct 2 ms 376 KB OK (n = 6, answer = YES)
10 Correct 2 ms 256 KB OK (n = 12, answer = YES)
11 Correct 2 ms 256 KB OK (n = 100, answer = NO)
12 Incorrect 2 ms 256 KB sum of weights should be in [50..51] but it is 73
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 256 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Correct 2 ms 376 KB OK (n = 2, answer = YES)
5 Correct 2 ms 380 KB OK (n = 2, answer = YES)
6 Correct 2 ms 256 KB OK (n = 3, answer = YES)
7 Correct 2 ms 376 KB OK (n = 3, answer = YES)
8 Correct 2 ms 376 KB OK (n = 3, answer = YES)
9 Correct 2 ms 376 KB OK (n = 3, answer = YES)
10 Correct 2 ms 376 KB OK (n = 3, answer = YES)
11 Correct 2 ms 376 KB OK (n = 3, answer = YES)
12 Correct 2 ms 376 KB OK (n = 3, answer = YES)
13 Correct 2 ms 424 KB OK (n = 3, answer = NO)
14 Correct 2 ms 376 KB OK (n = 3, answer = YES)
15 Correct 2 ms 376 KB OK (n = 3, answer = YES)
16 Correct 2 ms 376 KB OK (n = 3, answer = NO)
17 Correct 2 ms 376 KB OK (n = 3, answer = NO)
18 Correct 2 ms 376 KB OK (n = 100, answer = NO)
19 Correct 2 ms 256 KB OK (n = 100, answer = YES)
20 Correct 2 ms 292 KB OK (n = 12, answer = YES)
21 Correct 2 ms 256 KB OK (n = 12, answer = YES)
22 Correct 2 ms 256 KB OK (n = 12, answer = NO)
23 Correct 2 ms 256 KB OK (n = 12, answer = NO)
24 Correct 2 ms 376 KB OK (n = 12, answer = YES)
25 Correct 2 ms 376 KB OK (n = 12, answer = YES)
26 Correct 2 ms 376 KB OK (n = 12, answer = YES)
27 Correct 2 ms 380 KB OK (n = 12, answer = YES)
28 Correct 2 ms 376 KB OK (n = 6, answer = YES)
29 Correct 2 ms 256 KB OK (n = 12, answer = YES)
30 Correct 2 ms 256 KB OK (n = 100, answer = NO)
31 Incorrect 2 ms 256 KB sum of weights should be in [50..51] but it is 73
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 256 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Correct 2 ms 376 KB OK (n = 2, answer = YES)
5 Correct 2 ms 380 KB OK (n = 2, answer = YES)
6 Correct 2 ms 256 KB OK (n = 3, answer = YES)
7 Correct 2 ms 376 KB OK (n = 3, answer = YES)
8 Correct 2 ms 376 KB OK (n = 3, answer = YES)
9 Correct 2 ms 376 KB OK (n = 3, answer = YES)
10 Correct 2 ms 376 KB OK (n = 3, answer = YES)
11 Correct 2 ms 376 KB OK (n = 3, answer = YES)
12 Correct 2 ms 376 KB OK (n = 3, answer = YES)
13 Correct 2 ms 424 KB OK (n = 3, answer = NO)
14 Correct 2 ms 376 KB OK (n = 3, answer = YES)
15 Correct 2 ms 376 KB OK (n = 3, answer = YES)
16 Correct 2 ms 376 KB OK (n = 3, answer = NO)
17 Correct 2 ms 376 KB OK (n = 3, answer = NO)
18 Correct 2 ms 376 KB OK (n = 100, answer = NO)
19 Correct 2 ms 256 KB OK (n = 100, answer = YES)
20 Correct 2 ms 292 KB OK (n = 12, answer = YES)
21 Correct 2 ms 256 KB OK (n = 12, answer = YES)
22 Correct 2 ms 256 KB OK (n = 12, answer = NO)
23 Correct 2 ms 256 KB OK (n = 12, answer = NO)
24 Correct 2 ms 376 KB OK (n = 12, answer = YES)
25 Correct 2 ms 376 KB OK (n = 12, answer = YES)
26 Correct 2 ms 376 KB OK (n = 12, answer = YES)
27 Correct 2 ms 380 KB OK (n = 12, answer = YES)
28 Correct 2 ms 376 KB OK (n = 6, answer = YES)
29 Correct 2 ms 256 KB OK (n = 12, answer = YES)
30 Correct 2 ms 256 KB OK (n = 100, answer = NO)
31 Incorrect 2 ms 256 KB sum of weights should be in [50..51] but it is 73
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 256 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Correct 2 ms 376 KB OK (n = 2, answer = YES)
5 Correct 2 ms 380 KB OK (n = 2, answer = YES)
6 Correct 2 ms 256 KB OK (n = 3, answer = YES)
7 Correct 2 ms 376 KB OK (n = 3, answer = YES)
8 Correct 2 ms 376 KB OK (n = 3, answer = YES)
9 Correct 2 ms 376 KB OK (n = 3, answer = YES)
10 Correct 2 ms 376 KB OK (n = 3, answer = YES)
11 Correct 2 ms 376 KB OK (n = 3, answer = YES)
12 Correct 2 ms 376 KB OK (n = 3, answer = YES)
13 Correct 2 ms 424 KB OK (n = 3, answer = NO)
14 Correct 2 ms 376 KB OK (n = 3, answer = YES)
15 Correct 2 ms 376 KB OK (n = 3, answer = YES)
16 Correct 2 ms 376 KB OK (n = 3, answer = NO)
17 Correct 2 ms 376 KB OK (n = 3, answer = NO)
18 Correct 2 ms 376 KB OK (n = 100, answer = NO)
19 Correct 2 ms 256 KB OK (n = 100, answer = YES)
20 Correct 2 ms 292 KB OK (n = 12, answer = YES)
21 Correct 2 ms 256 KB OK (n = 12, answer = YES)
22 Correct 2 ms 256 KB OK (n = 12, answer = NO)
23 Correct 2 ms 256 KB OK (n = 12, answer = NO)
24 Correct 2 ms 376 KB OK (n = 12, answer = YES)
25 Correct 2 ms 376 KB OK (n = 12, answer = YES)
26 Correct 2 ms 376 KB OK (n = 12, answer = YES)
27 Correct 2 ms 380 KB OK (n = 12, answer = YES)
28 Correct 2 ms 376 KB OK (n = 6, answer = YES)
29 Correct 2 ms 256 KB OK (n = 12, answer = YES)
30 Correct 2 ms 256 KB OK (n = 100, answer = NO)
31 Incorrect 2 ms 256 KB sum of weights should be in [50..51] but it is 73
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 256 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Correct 2 ms 376 KB OK (n = 2, answer = YES)
5 Correct 2 ms 380 KB OK (n = 2, answer = YES)
6 Correct 2 ms 256 KB OK (n = 3, answer = YES)
7 Correct 2 ms 376 KB OK (n = 3, answer = YES)
8 Correct 2 ms 376 KB OK (n = 3, answer = YES)
9 Correct 2 ms 376 KB OK (n = 3, answer = YES)
10 Correct 2 ms 376 KB OK (n = 3, answer = YES)
11 Correct 2 ms 376 KB OK (n = 3, answer = YES)
12 Correct 2 ms 376 KB OK (n = 3, answer = YES)
13 Correct 2 ms 424 KB OK (n = 3, answer = NO)
14 Correct 2 ms 376 KB OK (n = 3, answer = YES)
15 Correct 2 ms 376 KB OK (n = 3, answer = YES)
16 Correct 2 ms 376 KB OK (n = 3, answer = NO)
17 Correct 2 ms 376 KB OK (n = 3, answer = NO)
18 Correct 2 ms 376 KB OK (n = 100, answer = NO)
19 Correct 2 ms 256 KB OK (n = 100, answer = YES)
20 Correct 2 ms 292 KB OK (n = 12, answer = YES)
21 Correct 2 ms 256 KB OK (n = 12, answer = YES)
22 Correct 2 ms 256 KB OK (n = 12, answer = NO)
23 Correct 2 ms 256 KB OK (n = 12, answer = NO)
24 Correct 2 ms 376 KB OK (n = 12, answer = YES)
25 Correct 2 ms 376 KB OK (n = 12, answer = YES)
26 Correct 2 ms 376 KB OK (n = 12, answer = YES)
27 Correct 2 ms 380 KB OK (n = 12, answer = YES)
28 Correct 2 ms 376 KB OK (n = 6, answer = YES)
29 Correct 2 ms 256 KB OK (n = 12, answer = YES)
30 Correct 2 ms 256 KB OK (n = 100, answer = NO)
31 Incorrect 2 ms 256 KB sum of weights should be in [50..51] but it is 73
32 Halted 0 ms 0 KB -