답안 #156521

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
156521 2019-10-06T10:12:44 Z a_player Detecting Molecules (IOI16_molecules) C++14
31 / 100
26 ms 12536 KB
#include <bits/stdc++.h>

#define f first
#define s second
#define mp make_pair
#define pb push_back

using namespace std;

//typedef long long ll;

pair<int,int> dp[10001][10001];
int v[10001];

int N,uu,ll;

bool ric(int n,int val){
	if(val>=uu&&val<=ll){
    dp[n][val].f=1;
      dp[n][val].s=-2;
       return 1;
    }
	if(n==N)return 0;
	if(val>ll)return 0;
	if(dp[n][val].f!=-1)return dp[n][val].f;
	if(ric(n+1,val)){
		dp[n][val].f=1;
		dp[n][val].s=0;
		return 1;
		}
	else if(ric(n+1,val+v[n])){
		dp[n][val].f=1;
		dp[n][val].s=1;
		return 1;
		}
		else {
			dp[n][val].f=0;
			dp[n][val].s=-1;
			return 0;
			}
			return 0;
	}
vector<int> find_subset(int l,int u,vector<int> w){
  uu=l;
ll=u;
  N=w.size();
	for(int i=0;i<1001;i++)
	for(int j=0;j<1001;j++)dp[i][j]=mp(-1,-1);
    for(int i=0;i<w.size();i++)v[i]=w[i];
	ric(0,0);
  vector<int> sol;
	if(dp[0][0].f==0)return sol;
	int val=0;
	int n=0;
	while(dp[n][val].s!=-2){
		if(dp[n][val].s==1){
			sol.push_back(n);
			val+=v[n];
			n++;
			}else n++;
		}
		
		
	return sol;
}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:49:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<w.size();i++)v[i]=w[i];
                 ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 12284 KB OK (n = 1, answer = NO)
2 Correct 11 ms 12280 KB OK (n = 1, answer = NO)
3 Correct 11 ms 12280 KB OK (n = 1, answer = YES)
4 Correct 11 ms 12280 KB OK (n = 2, answer = YES)
5 Correct 11 ms 12280 KB OK (n = 2, answer = YES)
6 Correct 13 ms 12252 KB OK (n = 3, answer = YES)
7 Correct 11 ms 12280 KB OK (n = 3, answer = YES)
8 Correct 11 ms 12280 KB OK (n = 3, answer = YES)
9 Correct 13 ms 12280 KB OK (n = 3, answer = YES)
10 Correct 13 ms 12280 KB OK (n = 3, answer = YES)
11 Correct 14 ms 12280 KB OK (n = 3, answer = YES)
12 Correct 12 ms 12284 KB OK (n = 3, answer = YES)
13 Correct 14 ms 12280 KB OK (n = 3, answer = NO)
14 Correct 13 ms 12280 KB OK (n = 3, answer = YES)
15 Correct 12 ms 12280 KB OK (n = 3, answer = YES)
16 Correct 11 ms 12280 KB OK (n = 3, answer = NO)
17 Correct 12 ms 12280 KB OK (n = 3, answer = NO)
18 Correct 14 ms 12344 KB OK (n = 100, answer = NO)
19 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 12280 KB OK (n = 12, answer = YES)
2 Correct 12 ms 12280 KB OK (n = 12, answer = YES)
3 Correct 12 ms 12280 KB OK (n = 12, answer = NO)
4 Correct 13 ms 12280 KB OK (n = 12, answer = NO)
5 Correct 24 ms 12280 KB OK (n = 12, answer = YES)
6 Correct 14 ms 12280 KB OK (n = 12, answer = YES)
7 Correct 12 ms 12280 KB OK (n = 12, answer = YES)
8 Correct 12 ms 12280 KB OK (n = 12, answer = YES)
9 Correct 12 ms 12284 KB OK (n = 6, answer = YES)
10 Correct 12 ms 12280 KB OK (n = 12, answer = YES)
11 Correct 14 ms 12280 KB OK (n = 100, answer = NO)
12 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
13 Correct 12 ms 12280 KB OK (n = 100, answer = NO)
14 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
15 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
16 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
17 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 12284 KB OK (n = 1, answer = NO)
2 Correct 11 ms 12280 KB OK (n = 1, answer = NO)
3 Correct 11 ms 12280 KB OK (n = 1, answer = YES)
4 Correct 11 ms 12280 KB OK (n = 2, answer = YES)
5 Correct 11 ms 12280 KB OK (n = 2, answer = YES)
6 Correct 13 ms 12252 KB OK (n = 3, answer = YES)
7 Correct 11 ms 12280 KB OK (n = 3, answer = YES)
8 Correct 11 ms 12280 KB OK (n = 3, answer = YES)
9 Correct 13 ms 12280 KB OK (n = 3, answer = YES)
10 Correct 13 ms 12280 KB OK (n = 3, answer = YES)
11 Correct 14 ms 12280 KB OK (n = 3, answer = YES)
12 Correct 12 ms 12284 KB OK (n = 3, answer = YES)
13 Correct 14 ms 12280 KB OK (n = 3, answer = NO)
14 Correct 13 ms 12280 KB OK (n = 3, answer = YES)
15 Correct 12 ms 12280 KB OK (n = 3, answer = YES)
16 Correct 11 ms 12280 KB OK (n = 3, answer = NO)
17 Correct 12 ms 12280 KB OK (n = 3, answer = NO)
18 Correct 14 ms 12344 KB OK (n = 100, answer = NO)
19 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
20 Correct 12 ms 12280 KB OK (n = 12, answer = YES)
21 Correct 12 ms 12280 KB OK (n = 12, answer = YES)
22 Correct 12 ms 12280 KB OK (n = 12, answer = NO)
23 Correct 13 ms 12280 KB OK (n = 12, answer = NO)
24 Correct 24 ms 12280 KB OK (n = 12, answer = YES)
25 Correct 14 ms 12280 KB OK (n = 12, answer = YES)
26 Correct 12 ms 12280 KB OK (n = 12, answer = YES)
27 Correct 12 ms 12280 KB OK (n = 12, answer = YES)
28 Correct 12 ms 12284 KB OK (n = 6, answer = YES)
29 Correct 12 ms 12280 KB OK (n = 12, answer = YES)
30 Correct 14 ms 12280 KB OK (n = 100, answer = NO)
31 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
32 Correct 12 ms 12280 KB OK (n = 100, answer = NO)
33 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
34 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
35 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
36 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
37 Correct 12 ms 12284 KB OK (n = 28, answer = YES)
38 Correct 11 ms 12280 KB OK (n = 27, answer = YES)
39 Correct 11 ms 12280 KB OK (n = 90, answer = YES)
40 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
41 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
42 Correct 12 ms 12280 KB OK (n = 10, answer = YES)
43 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
44 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
45 Correct 12 ms 12252 KB OK (n = 100, answer = YES)
46 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
47 Correct 12 ms 12280 KB OK (n = 100, answer = NO)
48 Correct 11 ms 12280 KB OK (n = 100, answer = NO)
49 Correct 12 ms 12284 KB OK (n = 100, answer = NO)
50 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
51 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
52 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
53 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
54 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 12284 KB OK (n = 1, answer = NO)
2 Correct 11 ms 12280 KB OK (n = 1, answer = NO)
3 Correct 11 ms 12280 KB OK (n = 1, answer = YES)
4 Correct 11 ms 12280 KB OK (n = 2, answer = YES)
5 Correct 11 ms 12280 KB OK (n = 2, answer = YES)
6 Correct 13 ms 12252 KB OK (n = 3, answer = YES)
7 Correct 11 ms 12280 KB OK (n = 3, answer = YES)
8 Correct 11 ms 12280 KB OK (n = 3, answer = YES)
9 Correct 13 ms 12280 KB OK (n = 3, answer = YES)
10 Correct 13 ms 12280 KB OK (n = 3, answer = YES)
11 Correct 14 ms 12280 KB OK (n = 3, answer = YES)
12 Correct 12 ms 12284 KB OK (n = 3, answer = YES)
13 Correct 14 ms 12280 KB OK (n = 3, answer = NO)
14 Correct 13 ms 12280 KB OK (n = 3, answer = YES)
15 Correct 12 ms 12280 KB OK (n = 3, answer = YES)
16 Correct 11 ms 12280 KB OK (n = 3, answer = NO)
17 Correct 12 ms 12280 KB OK (n = 3, answer = NO)
18 Correct 14 ms 12344 KB OK (n = 100, answer = NO)
19 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
20 Correct 12 ms 12280 KB OK (n = 12, answer = YES)
21 Correct 12 ms 12280 KB OK (n = 12, answer = YES)
22 Correct 12 ms 12280 KB OK (n = 12, answer = NO)
23 Correct 13 ms 12280 KB OK (n = 12, answer = NO)
24 Correct 24 ms 12280 KB OK (n = 12, answer = YES)
25 Correct 14 ms 12280 KB OK (n = 12, answer = YES)
26 Correct 12 ms 12280 KB OK (n = 12, answer = YES)
27 Correct 12 ms 12280 KB OK (n = 12, answer = YES)
28 Correct 12 ms 12284 KB OK (n = 6, answer = YES)
29 Correct 12 ms 12280 KB OK (n = 12, answer = YES)
30 Correct 14 ms 12280 KB OK (n = 100, answer = NO)
31 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
32 Correct 12 ms 12280 KB OK (n = 100, answer = NO)
33 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
34 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
35 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
36 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
37 Correct 12 ms 12284 KB OK (n = 28, answer = YES)
38 Correct 11 ms 12280 KB OK (n = 27, answer = YES)
39 Correct 11 ms 12280 KB OK (n = 90, answer = YES)
40 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
41 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
42 Correct 12 ms 12280 KB OK (n = 10, answer = YES)
43 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
44 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
45 Correct 12 ms 12252 KB OK (n = 100, answer = YES)
46 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
47 Correct 12 ms 12280 KB OK (n = 100, answer = NO)
48 Correct 11 ms 12280 KB OK (n = 100, answer = NO)
49 Correct 12 ms 12284 KB OK (n = 100, answer = NO)
50 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
51 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
52 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
53 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
54 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
55 Incorrect 26 ms 12536 KB Contestant can not find answer, jury can
56 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 12284 KB OK (n = 1, answer = NO)
2 Correct 11 ms 12280 KB OK (n = 1, answer = NO)
3 Correct 11 ms 12280 KB OK (n = 1, answer = YES)
4 Correct 11 ms 12280 KB OK (n = 2, answer = YES)
5 Correct 11 ms 12280 KB OK (n = 2, answer = YES)
6 Correct 13 ms 12252 KB OK (n = 3, answer = YES)
7 Correct 11 ms 12280 KB OK (n = 3, answer = YES)
8 Correct 11 ms 12280 KB OK (n = 3, answer = YES)
9 Correct 13 ms 12280 KB OK (n = 3, answer = YES)
10 Correct 13 ms 12280 KB OK (n = 3, answer = YES)
11 Correct 14 ms 12280 KB OK (n = 3, answer = YES)
12 Correct 12 ms 12284 KB OK (n = 3, answer = YES)
13 Correct 14 ms 12280 KB OK (n = 3, answer = NO)
14 Correct 13 ms 12280 KB OK (n = 3, answer = YES)
15 Correct 12 ms 12280 KB OK (n = 3, answer = YES)
16 Correct 11 ms 12280 KB OK (n = 3, answer = NO)
17 Correct 12 ms 12280 KB OK (n = 3, answer = NO)
18 Correct 14 ms 12344 KB OK (n = 100, answer = NO)
19 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
20 Correct 12 ms 12280 KB OK (n = 12, answer = YES)
21 Correct 12 ms 12280 KB OK (n = 12, answer = YES)
22 Correct 12 ms 12280 KB OK (n = 12, answer = NO)
23 Correct 13 ms 12280 KB OK (n = 12, answer = NO)
24 Correct 24 ms 12280 KB OK (n = 12, answer = YES)
25 Correct 14 ms 12280 KB OK (n = 12, answer = YES)
26 Correct 12 ms 12280 KB OK (n = 12, answer = YES)
27 Correct 12 ms 12280 KB OK (n = 12, answer = YES)
28 Correct 12 ms 12284 KB OK (n = 6, answer = YES)
29 Correct 12 ms 12280 KB OK (n = 12, answer = YES)
30 Correct 14 ms 12280 KB OK (n = 100, answer = NO)
31 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
32 Correct 12 ms 12280 KB OK (n = 100, answer = NO)
33 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
34 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
35 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
36 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
37 Correct 12 ms 12284 KB OK (n = 28, answer = YES)
38 Correct 11 ms 12280 KB OK (n = 27, answer = YES)
39 Correct 11 ms 12280 KB OK (n = 90, answer = YES)
40 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
41 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
42 Correct 12 ms 12280 KB OK (n = 10, answer = YES)
43 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
44 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
45 Correct 12 ms 12252 KB OK (n = 100, answer = YES)
46 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
47 Correct 12 ms 12280 KB OK (n = 100, answer = NO)
48 Correct 11 ms 12280 KB OK (n = 100, answer = NO)
49 Correct 12 ms 12284 KB OK (n = 100, answer = NO)
50 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
51 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
52 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
53 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
54 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
55 Incorrect 26 ms 12536 KB Contestant can not find answer, jury can
56 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 12284 KB OK (n = 1, answer = NO)
2 Correct 11 ms 12280 KB OK (n = 1, answer = NO)
3 Correct 11 ms 12280 KB OK (n = 1, answer = YES)
4 Correct 11 ms 12280 KB OK (n = 2, answer = YES)
5 Correct 11 ms 12280 KB OK (n = 2, answer = YES)
6 Correct 13 ms 12252 KB OK (n = 3, answer = YES)
7 Correct 11 ms 12280 KB OK (n = 3, answer = YES)
8 Correct 11 ms 12280 KB OK (n = 3, answer = YES)
9 Correct 13 ms 12280 KB OK (n = 3, answer = YES)
10 Correct 13 ms 12280 KB OK (n = 3, answer = YES)
11 Correct 14 ms 12280 KB OK (n = 3, answer = YES)
12 Correct 12 ms 12284 KB OK (n = 3, answer = YES)
13 Correct 14 ms 12280 KB OK (n = 3, answer = NO)
14 Correct 13 ms 12280 KB OK (n = 3, answer = YES)
15 Correct 12 ms 12280 KB OK (n = 3, answer = YES)
16 Correct 11 ms 12280 KB OK (n = 3, answer = NO)
17 Correct 12 ms 12280 KB OK (n = 3, answer = NO)
18 Correct 14 ms 12344 KB OK (n = 100, answer = NO)
19 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
20 Correct 12 ms 12280 KB OK (n = 12, answer = YES)
21 Correct 12 ms 12280 KB OK (n = 12, answer = YES)
22 Correct 12 ms 12280 KB OK (n = 12, answer = NO)
23 Correct 13 ms 12280 KB OK (n = 12, answer = NO)
24 Correct 24 ms 12280 KB OK (n = 12, answer = YES)
25 Correct 14 ms 12280 KB OK (n = 12, answer = YES)
26 Correct 12 ms 12280 KB OK (n = 12, answer = YES)
27 Correct 12 ms 12280 KB OK (n = 12, answer = YES)
28 Correct 12 ms 12284 KB OK (n = 6, answer = YES)
29 Correct 12 ms 12280 KB OK (n = 12, answer = YES)
30 Correct 14 ms 12280 KB OK (n = 100, answer = NO)
31 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
32 Correct 12 ms 12280 KB OK (n = 100, answer = NO)
33 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
34 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
35 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
36 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
37 Correct 12 ms 12284 KB OK (n = 28, answer = YES)
38 Correct 11 ms 12280 KB OK (n = 27, answer = YES)
39 Correct 11 ms 12280 KB OK (n = 90, answer = YES)
40 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
41 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
42 Correct 12 ms 12280 KB OK (n = 10, answer = YES)
43 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
44 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
45 Correct 12 ms 12252 KB OK (n = 100, answer = YES)
46 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
47 Correct 12 ms 12280 KB OK (n = 100, answer = NO)
48 Correct 11 ms 12280 KB OK (n = 100, answer = NO)
49 Correct 12 ms 12284 KB OK (n = 100, answer = NO)
50 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
51 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
52 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
53 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
54 Correct 12 ms 12280 KB OK (n = 100, answer = YES)
55 Incorrect 26 ms 12536 KB Contestant can not find answer, jury can
56 Halted 0 ms 0 KB -