Submission #69052

# Submission time Handle Problem Language Result Execution time Memory
69052 2018-08-19T15:31:57 Z TuGSGeReL Detecting Molecules (IOI16_molecules) C++14
0 / 100
2 ms 560 KB
#include "molecules.h"
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pub push_back
#define pob pop_back
#define ss second
#define ff first
#define ext exit(0)
using namespace std;
int i;
ll s;
vector<pair<int,int> >v;
vector<int> find_subset(int l, int u, vector<int> w) {
	for(i=0;i<w.size();i++) v.pub(mp(w[i],i));
	sort(v.begin(),v.end());
	deque<pair<int,int> >ans1;
	vector<int>ans;
	for(i=0;i<v.size();i++){
		if(s+v[i].ff<=u){
			s+=v[i].ff;
			ans1.pub(v[i]);
		}
		else if(s-ans1[0].ff+v[i].ff<=u){
			s-=ans1[0].ff-v[i].ff;
			ans1.pop_front();
			ans1.pub(v[i]);
		}
	}
	for(i=0;i<ans1.size();i++){
		ans.pub(ans1[i].ss);
	}
	return ans;
}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:15:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=0;i<w.size();i++) v.pub(mp(w[i],i));
          ~^~~~~~~~~
molecules.cpp:19:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=0;i<v.size();i++){
          ~^~~~~~~~~
molecules.cpp:30:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=0;i<ans1.size();i++){
          ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 356 KB OK (n = 12, answer = YES)
2 Correct 2 ms 560 KB OK (n = 12, answer = YES)
3 Incorrect 2 ms 560 KB sum of weights should be in [307..317] but it is 306
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -