Submission #394212

# Submission time Handle Problem Language Result Execution time Memory
394212 2021-04-26T06:28:48 Z wenqi Jelly Flavours (IOI20_jelly) C++14
0 / 100
8 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 N = a.size();
    valarray<int> sides(0, N);
    int X = x;
    int Y = y;
    for (int i = 0; i < N; i++) {
        if(a[i] <= X) {
            sides[i] = 1;
            X -= a[i];
        }else if(b[i] <= Y) {
            sides[i] = 2;
            Y -= b[i];
        }
        if(sides[i] != 0) continue;
        for(int j = 0; j < i; j++) {
            if(sides[j] == 1) {
                if(a[i] <= X + a[j] and b[j] <= Y) {
                    X += a[j] - a[i];
                    Y -= b[j];
                    sides[j] = 2;
                    sides[i] = 1;
                    break;
                }
            }else if(sides[j] == 2) {
                if(b[i] <= Y + b[j] and a[j] <= X) {
                    Y += b[j] - b[i];
                    X -= a[j];
                    sides[j] = 1;
                    sides[i] = 2;
                    break;
                }
            }
        }
    }
    int ans = 0;
    for (int i = 0; i < N; i++) {
        ans += sides[i] != 0;
    }
	return ans;
}
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 332 KB 1st lines differ - on the 1st token, expected: '689', found: '648'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 308 KB 1st lines differ - on the 1st token, expected: '62', found: '8'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 332 KB 1st lines differ - on the 1st token, expected: '154', found: '18'
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: '7'
2 Halted 0 ms 0 KB -