Submission #406442

# Submission time Handle Problem Language Result Execution time Memory
406442 2021-05-17T15:24:51 Z victoriad Jelly Flavours (IOI20_jelly) C++14
0 / 100
2 ms 332 KB
#include "jelly.h"
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <utility>
#include <queue>
#include <map>
#include <iomanip>
#include <stack>
#include <fstream>
using namespace std;

int find_maximum_unique(int x, int y, std::vector<int> a, std::vector<int> b) {
	int n = a.size();
		vector<pair<int,int> >pa(n);
		vector<pair<int,int> >pb(n);
		for(int i=0;i<n;i++){
			pa[i]=make_pair(a[i],i);
			pb[i]=make_pair(b[i],i);
		}
		sort(pb.begin(),pb.end());
		sort(pa.begin(),pa.end());
		int r=0;
		vector<bool>v(n,false);
		bool f=true,s=true;
		for(int i=0;i<n;i++){
			if(f){
			if(!v[pb[i].second]){
				if(pb[i].first<=y){
					r++;
					y-=pb[i].first;
				}
				else{
					f=false;
				}
			}
			}
			if(s){
			if(!v[pa[i].second]){
				if(pa[i].first<=x){
					r++;
					x-=pa[i].first;
				}
				else{
					s=false;
				}
			}
			}
			if(!f && !s)break;

		}
		return r;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB 1st lines differ - on the 1st token, expected: '8', found: '9'
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: '9'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 304 KB 1st lines differ - on the 1st token, expected: '689', found: '700'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Incorrect 2 ms 332 KB 1st lines differ - on the 1st token, expected: '1906', found: '3242'
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB 1st lines differ - on the 1st token, expected: '154', found: '195'
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: '9'
2 Halted 0 ms 0 KB -