Submission #81771

# Submission time Handle Problem Language Result Execution time Memory
81771 2018-10-26T13:41:58 Z AngelKnows Detecting Molecules (IOI16_molecules) C++14
0 / 100
2 ms 516 KB
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
const int inf=0x3f3f3f3f;

std::vector<int> find_subset(int l, int u, std::vector<int> w) {
	sort(w.begin(),w.end());
	vector<int> ans;
	int L=l,R=u;
	if (L<=w[0]&&w[0]<=R) {
		ans.push_back(w[0]);
		return ans;
	} else if (w[0]>R) {
		return vector<int>(0);
	} else if (w[0]<L) {
		int t=w.back();
		if (L<=t&&t<=R) {
			ans.push_back(t);
			return ans;
		} else if (t<L) {
			long long sum=0;
			for (int i=0;i<w.size();i++) {
				sum+=w[i];
				ans.push_back(w[i]);
				if (L<=sum&&sum<=R) {
					return ans;
				}
			}
			return vector<int>(0);
		}
	}
}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:22:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (int i=0;i<w.size();i++) {
                 ~^~~~~~~~~
molecules.cpp:32:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB OK (n = 1, answer = NO)
2 Correct 2 ms 504 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 516 KB Integer 10 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 516 KB Contestant can not find answer, jury can
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB OK (n = 1, answer = NO)
2 Correct 2 ms 504 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 516 KB Integer 10 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB OK (n = 1, answer = NO)
2 Correct 2 ms 504 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 516 KB Integer 10 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB OK (n = 1, answer = NO)
2 Correct 2 ms 504 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 516 KB Integer 10 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB OK (n = 1, answer = NO)
2 Correct 2 ms 504 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 516 KB Integer 10 violates the range [0, 0]
4 Halted 0 ms 0 KB -