답안 #405078

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
405078 2021-05-15T16:43:39 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(b[i]);
		}
		else
		{
			cont++;
		}
	}
	int n = a.size();
	sort(a.begin(), a.end());
	int i = 0;
	while (x - a[i] >= 0 && i < n)
	{
		if (x - a[i] >= 0)
		{
			cont++;
			x -= a[i];
		}
		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 204 KB 1st lines differ - on the 1st token, expected: '8', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB 1st lines differ - on the 1st token, expected: '8', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 304 KB 1st lines differ - on the 1st token, expected: '689', found: '700'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 332 KB 1st lines differ - on the 1st token, expected: '62', found: '60'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 308 KB 1st lines differ - on the 1st token, expected: '154', found: '146'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB 1st lines differ - on the 1st token, expected: '8', found: '5'
2 Halted 0 ms 0 KB -