Submission #505898

# Submission time Handle Problem Language Result Execution time Memory
505898 2022-01-11T09:30:58 Z Carmel_Ab1 King of Chairs (FXCUP4_chairs) C++17
95 / 100
138 ms 14708 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/16;
}
#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=16*B+15;
    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 492 KB Correct
3 Correct 0 ms 484 KB Correct
4 Correct 1 ms 492 KB Correct
5 Correct 0 ms 484 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 50 ms 7784 KB Correct
2 Correct 100 ms 13276 KB Correct
3 Correct 108 ms 14596 KB Correct
4 Correct 101 ms 14504 KB Correct
5 Correct 98 ms 14520 KB Correct
6 Correct 100 ms 14540 KB Correct
7 Correct 100 ms 14528 KB Correct
# Verdict Execution time Memory Grader output
1 Partially correct 66 ms 7852 KB B = 62499
2 Partially correct 129 ms 13432 KB B = 62499
3 Partially correct 114 ms 14572 KB B = 62305
4 Partially correct 128 ms 14652 KB B = 62498
5 Partially correct 133 ms 14708 KB B = 62499
6 Partially correct 138 ms 14552 KB B = 62499
7 Partially correct 112 ms 14624 KB B = 62366
8 Correct 96 ms 14576 KB Correct