답안 #400909

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
400909 2021-05-08T19:59:35 Z Divanny Jelly Flavours (IOI20_jelly) C++14
0 / 100
25 ms 324 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 n = a.size();
	int cont = 0, i = 0;
	while (x > 0 || y > 0)
	{
		if (min(*min_element(a.begin(), a.end()), *min_element(b.begin(), b.end())) == *min_element(a.begin(), a.end()))
		{
			i = min_element(a.begin(), a.end()) - a.begin();
		}
		else
		{
			i = min_element(b.begin(), b.end()) - b.begin();
		}
		if ((a[i] < b[i] && x - a[i] >= 0) || (y - b[i] < 0 && x - a[i] >= 0))
		{
			x -= a[i];
			a[i] = 10001;
			b[i] = 10001;
			cont++;
		}
		else if (y - b[i] >= 0)
		{
			y -= b[i];
			a[i] = 10001;
			b[i] = 10001;
			cont++;
		}
		else
		{
			break;
		}
	}
	return cont;
}

Compilation message

jelly.cpp: In function 'int find_maximum_unique(int, int, std::vector<int>, std::vector<int>)':
jelly.cpp:8:6: warning: unused variable 'n' [-Wunused-variable]
    8 |  int n = a.size();
      |      ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB 1st lines differ - on the 1st token, expected: '8', found: '7'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB 1st lines differ - on the 1st token, expected: '8', found: '7'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 204 KB 1st lines differ - on the 1st token, expected: '689', found: '644'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 204 KB Output is correct
2 Correct 2 ms 204 KB Output is correct
3 Correct 2 ms 204 KB Output is correct
4 Correct 24 ms 320 KB Output is correct
5 Correct 25 ms 204 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 2 ms 204 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 24 ms 204 KB Output is correct
10 Correct 24 ms 204 KB Output is correct
11 Correct 2 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 2 ms 204 KB Output is correct
14 Correct 24 ms 204 KB Output is correct
15 Correct 16 ms 204 KB Output is correct
16 Correct 2 ms 204 KB Output is correct
17 Incorrect 1 ms 204 KB 1st lines differ - on the 1st token, expected: '69', found: '7'
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 204 KB Output is correct
2 Correct 3 ms 204 KB Output is correct
3 Correct 2 ms 204 KB Output is correct
4 Correct 24 ms 204 KB Output is correct
5 Incorrect 23 ms 324 KB 1st lines differ - on the 1st token, expected: '1867', found: '1866'
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB 1st lines differ - on the 1st token, expected: '8', found: '7'
2 Halted 0 ms 0 KB -