답안 #313849

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
313849 2020-10-17T07:14:15 Z IWANTTOGETGOLDINIOI Detecting Molecules (IOI16_molecules) C++14
0 / 100
1 ms 384 KB
#include "molecules.h"
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>

std::vector<int> find_subset(int l, int u, std::vector<int> w) {
	int n = w.size();
	std::vector <std::pair <int , int> > subset;
	for (int i = 0;i < n;i++) {
		for (int j = 0;j < n; j++ ) {
			subset.push_back(std::make_pair (i , j));
		}
	}	
	std::vector <int> ans;
	for (int i = 0;i < subset.size(); i++) {
		int sum = 0;
		for (int j = std::min (subset[i].first , subset[i].second) ;j < std::max(subset[i].second,subset[i].first); j++) {
			sum += w[j];
		}
		ans.clear();
		if (sum >= l && sum <= u) {
			for (int k = subset[i].first;k < subset[i].second;k++) {
				ans.push_back(w[k]);
			}
			return ans;
		} 
	}
	return ans;
}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:16:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |  for (int i = 0;i < subset.size(); i++) {
      |                 ~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 384 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 256 KB Integer 50 violates the range [0, 11]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 384 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 384 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 384 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 384 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -