답안 #405083

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
405083 2021-05-15T16:48:45 Z Divanny Jelly Flavours (IOI20_jelly) C++14
0 / 100
2 ms 332 KB
#include "jelly.h"
#include <bits/stdc++.h>
 
using namespace std;
 
int find_maximum_unique(int x, int y, vector<int> a, vector<int> b) 
{
	int cont = 0;
	vector <int> no_gratis;
	for (int i = 0; i < b.size(); i++)
	{
		if(b[i] != 0)
		{
			no_gratis.push_back(i);
		}
		else
		{
			cont++;
		}
	}
	int n = a.size();
	sort(a.begin(), a.end());
	int i = 0;
	int ia = 0;
	while (x - a[i] >= 0 && i < n)
	{
		if (x - a[i] >= 0 && i != no_gratis[ia])
		{
			cont++;
			x -= a[i];
		}
		else
		{
			ia++;
		}
		i++;
	}
	return cont;
}

Compilation message

jelly.cpp: In function 'int find_maximum_unique(int, int, std::vector<int>, std::vector<int>)':
jelly.cpp:10:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |  for (int i = 0; i < b.size(); i++)
      |                  ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 296 KB 1st lines differ - on the 1st token, expected: '8', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 296 KB 1st lines differ - on the 1st token, expected: '8', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 304 KB 1st lines differ - on the 1st token, expected: '689', found: '675'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 332 KB 1st lines differ - on the 1st token, expected: '62', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 332 KB 1st lines differ - on the 1st token, expected: '154', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 296 KB 1st lines differ - on the 1st token, expected: '8', found: '0'
2 Halted 0 ms 0 KB -