Submission #505860

# Submission time Handle Problem Language Result Execution time Memory
505860 2022-01-11T09:03:52 Z Carmel_Ab1 King of Chairs (FXCUP4_chairs) C++17
38 / 100
128 ms 17296 KB
#include "king.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;

ll SendInfo(vi W, vi C) {
    multiset<int>s;
    int n=C.size();
    for(int i=0; i<n; i++)
        s.insert(C[i]);

    int ans=0;
    for(int i=0; i<n; i++){
        auto it=s.lower_bound(W[i]);
        if(it==s.end())break;
        s.erase(it);
        ans++;
    }
    return ans;
}
#include "vassal.h"


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int>pi;
int pref=0;
multiset<pi>s;

void Init(ll B, vi C){
    pref=B;
    int n=C.size();
    for(int i=0; i<n; i++)
        s.insert({C[i],i});
}

int Maid(int W){
    if(!pref)return -1;
    --pref;
    auto it=s.upper_bound({W,-1});
    int ans=it->second;
    s.erase(it);
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 544 KB Correct
2 Correct 1 ms 484 KB Correct
3 Incorrect 0 ms 488 KB Wrong
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 63 ms 7664 KB Correct
2 Correct 92 ms 16024 KB Correct
3 Correct 128 ms 17276 KB Correct
4 Correct 105 ms 17216 KB Correct
5 Correct 124 ms 17260 KB Correct
6 Correct 110 ms 17248 KB Correct
7 Correct 102 ms 17296 KB Correct
# Verdict Execution time Memory Grader output
1 Incorrect 60 ms 7804 KB Wrong
2 Halted 0 ms 0 KB -