Submission #505878

# Submission time Handle Problem Language Result Execution time Memory
505878 2022-01-11T09:16:42 Z Carmel_Ab1 King of Chairs (FXCUP4_chairs) C++17
95 / 100
144 ms 17376 KB
#include "king.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define all(x) x.begin(),x.end()

ll SendInfo(vi W, vi C) {
    sort(all(W));
    sort(all(C));

    int n=C.size();
    multiset<int>s;
    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;
        ans=*it;
        s.erase(it);
    }
    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 mx=0;
multiset<pi>s;

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

int Maid(int W){
    if(W>mx)return -1;
    auto it=s.upper_bound({W,-1});
    if(it==s.end())return -1;
    int ans=it->second;
    s.erase(it);
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 484 KB Correct
2 Correct 0 ms 484 KB Correct
3 Correct 0 ms 492 KB Correct
4 Correct 1 ms 572 KB Correct
5 Correct 1 ms 488 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 49 ms 7728 KB Correct
2 Correct 90 ms 13312 KB Correct
3 Correct 105 ms 14576 KB Correct
4 Correct 103 ms 14560 KB Correct
5 Correct 110 ms 14460 KB Correct
6 Correct 108 ms 14488 KB Correct
7 Correct 109 ms 14664 KB Correct
# Verdict Execution time Memory Grader output
1 Partially correct 66 ms 7776 KB B = 999992
2 Partially correct 144 ms 15836 KB B = 999987
3 Partially correct 119 ms 17212 KB B = 996893
4 Partially correct 140 ms 17376 KB B = 999972
5 Partially correct 135 ms 17316 KB B = 999997
6 Partially correct 130 ms 17284 KB B = 999991
7 Partially correct 135 ms 17216 KB B = 997863
8 Correct 95 ms 17272 KB Correct