답안 #156513

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
156513 2019-10-06T09:35:27 Z a_player Detecting Molecules (IOI16_molecules) C++14
0 / 100
2 ms 376 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[1001][1001];
int v[1001];

int N,uu,ll;

bool ric(int n,int val){
	if(val>=uu&&val<=ll)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){
      vector<int> sol;
     if(w[0]*w.size()<u)return sol;
     if(w[0]>l)return sol;
     int h=u/w[0];
     int s=h*w[0];
  		if(s+w[0]>l)return sol;
     if(s==u){
       for(int i=0;i<h;i++)sol.push_back(i);
       return sol;
     }
     if(s+w[0]>=u&&s+w[0]<=l){
       for(int i=0;i<h+1;i++)sol.push_back(i);
       return sol;
     }
  return sol;
}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:41:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
      if(w[0]*w.size()<u)return sol;
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 252 KB Contestant can not find answer, jury can
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -