제출 #491949

#제출 시각아이디문제언어결과실행 시간메모리
491949StoRovinatoDetecting Molecules (IOI16_molecules)C++14
9 / 100
0 ms256 KiB
#include <vector>
#include <algorithm>

#include "molecules.h"

using namespace std;

typedef long long ll;

vector<int> find_subset(int l, int u, vector<int> w)
{
	sort(w.begin(), w.end());
	vector<ll> pref(w.size() + 1);

	pref[0] = 0;
	for (int i = 1; i <= w.size(); i++)
		pref[i] = pref[i - 1] + w[i - 1];

	vector<int> ris;

	for (int i = 1; i <= w.size(); i++)
	{
		int finale = lower_bound(pref.begin(), pref.end(), l + pref[i - 1]) - pref.begin();

		//cout << i << " - " << finale << "\n";

		if (finale <= w.size() && pref[finale]  - pref[i - 1] <= u)
		{
			for (int j = i - 1; j < finale; j++)
				ris.push_back(j);
			break;
		}
	}

	return ris;
}

컴파일 시 표준 에러 (stderr) 메시지

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:16:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |  for (int i = 1; i <= w.size(); i++)
      |                  ~~^~~~~~~~~~~
molecules.cpp:21:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |  for (int i = 1; i <= w.size(); i++)
      |                  ~~^~~~~~~~~~~
molecules.cpp:27:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |   if (finale <= w.size() && pref[finale]  - pref[i - 1] <= u)
      |       ~~~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...