Submission #400903

# Submission time Handle Problem Language Result Execution time Memory
400903 2021-05-08T19:48:46 Z Divanny Jelly Flavours (IOI20_jelly) C++14
0 / 100
7 ms 320 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;
	while (x > 0 || y > 0)
	{
		int i = min_element(a.begin(), a.end()) - a.begin();
		if ((a[i] < b[i] && x - a[i] >= 0) || (y - b[i] < 0 && x - a[i] >= 0))
		{
			x -= a[i];
			a[i] = 10,001;
			b[i] = 10,001;
			cont++;
		}
		else if (y - b[i] >= 0)
		{
			y -= b[i];
			a[i] = 10,001;
			b[i] = 10,001;
			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:16:17: warning: right operand of comma operator has no effect [-Wunused-value]
   16 |    a[i] = 10,001;
      |                 ^
jelly.cpp:17:17: warning: right operand of comma operator has no effect [-Wunused-value]
   17 |    b[i] = 10,001;
      |                 ^
jelly.cpp:23:17: warning: right operand of comma operator has no effect [-Wunused-value]
   23 |    a[i] = 10,001;
      |                 ^
jelly.cpp:24:17: warning: right operand of comma operator has no effect [-Wunused-value]
   24 |    b[i] = 10,001;
      |                 ^
jelly.cpp:8:6: warning: unused variable 'n' [-Wunused-variable]
    8 |  int n = a.size();
      |      ^
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB 1st lines differ - on the 1st token, expected: '8', found: '55'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB 1st lines differ - on the 1st token, expected: '8', found: '55'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 204 KB 1st lines differ - on the 1st token, expected: '689', found: '177'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 320 KB 1st lines differ - on the 1st token, expected: '62', found: '1072'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 204 KB 1st lines differ - on the 1st token, expected: '154', found: '1034'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB 1st lines differ - on the 1st token, expected: '8', found: '55'
2 Halted 0 ms 0 KB -