답안 #159722

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
159722 2019-10-24T07:48:11 Z nabilervatra Detecting Molecules (IOI16_molecules) C++14
0 / 100
2 ms 376 KB
#include "molecules.h"
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
using namespace std;
int p1,p2,jml;
vector<int> ans;
vector<pair<int,int>> v;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
	for(int i =0;i<w.size();i++){
		v.pb({w[i],i+1});
	}
    sort(v.begin(),v.end());
    p1=0;
    p2=0;
    while(p2<v.size()){
    	jml+=v[p2].fi;
    	if(jml>=l&&jml<=u){
    		for(int i =p1;i<=p2;i++){
    			ans.pb(v[i].se);
    		}
    		break;
    	}
    	if(jml>u){
    		jml-=v[p1].fi;
    		p1++;
    	}
    	p2++;
    }

    return ans;
}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:11:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i =0;i<w.size();i++){
               ~^~~~~~~~~
molecules.cpp:17:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while(p2<v.size()){
           ~~^~~~~~~~~
# 결과 실행 시간 메모리 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 376 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 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 376 KB Integer 1 violates the range [0, 0]
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 376 KB Integer 1 violates the range [0, 0]
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 376 KB Integer 1 violates the range [0, 0]
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 376 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -