답안 #418749

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
418749 2021-06-05T19:48:37 Z iraira655 Jelly Flavours (IOI20_jelly) C++17
0 / 100
2 ms 384 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();
  
  vector<pair<int, int>> a1, b1;

	for(int i =0; i<n; i++){
		a1.push_back({a[i], b[i]});
	}
  sort(a1.begin(), a1.end());

  int ans = 0;
  for(int j=0; j<n; j++){
    if(a1[j].first < a1[j].second && x >= a1[j].first){
      x-=a1[j].first;
      ans++;
    }
    else if(a1[j].first == a1[j].second){
      if(x<=y && y>= a1[j].second){
        y-=a1[j].second;
        ans++;
      }
      else if(x>=y && x>= a1[j].first){
        x-=a1[j].first;
        ans++;
      }
    }
    else if(a1[j].first > a1[j].second && y >= a1[j].second){
      y-=a1[j].second;
      ans++;
    }
  }


	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB 1st lines differ - on the 1st token, expected: '8', found: '4'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB 1st lines differ - on the 1st token, expected: '8', found: '4'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 332 KB 1st lines differ - on the 1st token, expected: '689', found: '642'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Incorrect 2 ms 332 KB 1st lines differ - on the 1st token, expected: '1912', found: '1823'
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Incorrect 1 ms 332 KB 1st lines differ - on the 1st token, expected: '1867', found: '1866'
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB 1st lines differ - on the 1st token, expected: '8', found: '4'
2 Halted 0 ms 0 KB -