Submission #505896

# Submission time Handle Problem Language Result Execution time Memory
505896 2022-01-11T09:30:20 Z Carmel_Ab1 King of Chairs (FXCUP4_chairs) C++17
95 / 100
152 ms 14840 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/8;
}
#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=8*B+7;
    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 1 ms 484 KB Correct
2 Correct 1 ms 484 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 55 ms 7720 KB Correct
2 Correct 109 ms 13284 KB Correct
3 Correct 98 ms 14604 KB Correct
4 Correct 106 ms 14576 KB Correct
5 Correct 110 ms 14572 KB Correct
6 Correct 105 ms 14508 KB Correct
7 Correct 99 ms 14588 KB Correct
# Verdict Execution time Memory Grader output
1 Partially correct 64 ms 7984 KB B = 124999
2 Partially correct 130 ms 13672 KB B = 124998
3 Partially correct 123 ms 14704 KB B = 124611
4 Partially correct 138 ms 14716 KB B = 124996
5 Partially correct 152 ms 14784 KB B = 124999
6 Partially correct 148 ms 14840 KB B = 124998
7 Partially correct 132 ms 14820 KB B = 124732
8 Correct 102 ms 14624 KB Correct