Submission #132929

# Submission time Handle Problem Language Result Execution time Memory
132929 2019-07-20T01:03:25 Z wzy Detecting Molecules (IOI16_molecules) C++11
0 / 100
2 ms 376 KB
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
	vector<pii> v;
	for(int i = 0 ; i < w.size() ; i ++) v.push_back({w[i] , i});
	sort(v.begin() , v.end());
	int lx = 0 ;
	int curr = 0;
	for(int i = 0 ; i < w.size(); i ++){
		curr += v[i].first;
		while(curr >= u && lx != (i)){
			curr -= v[lx].first;
			lx++;
		}	
		if(curr <= u && curr >= l){
			vector<int> p ;
			for(int j = lx ; j <= i ; j ++){
				p.push_back(v[j].second);
			}
			return p;
		}
	}
	return vector<int>();
}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:7:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0 ; i < w.size() ; i ++) v.push_back({w[i] , i});
                  ~~^~~~~~~~~~
molecules.cpp:11:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0 ; i < w.size(); i ++){
                  ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 356 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Incorrect 2 ms 376 KB Contestant can not find answer, jury can
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB OK (n = 12, answer = YES)
2 Correct 2 ms 376 KB OK (n = 12, answer = YES)
3 Correct 2 ms 256 KB OK (n = 12, answer = NO)
4 Correct 2 ms 252 KB OK (n = 12, answer = NO)
5 Incorrect 2 ms 256 KB Contestant can not find answer, jury can
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 356 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Incorrect 2 ms 376 KB Contestant can not find answer, jury can
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 356 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Incorrect 2 ms 376 KB Contestant can not find answer, jury can
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 356 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Incorrect 2 ms 376 KB Contestant can not find answer, jury can
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 356 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Incorrect 2 ms 376 KB Contestant can not find answer, jury can
5 Halted 0 ms 0 KB -