Submission #505893

# Submission time Handle Problem Language Result Execution time Memory
505893 2022-01-11T09:29:34 Z Carmel_Ab1 King of Chairs (FXCUP4_chairs) C++17
95 / 100
166 ms 15740 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/4;
}
#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=4*B+3;
    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 2 ms 496 KB Correct
2 Correct 2 ms 556 KB Correct
3 Correct 2 ms 564 KB Correct
4 Correct 2 ms 668 KB Correct
5 Correct 1 ms 488 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 51 ms 8560 KB Correct
2 Correct 111 ms 14236 KB Correct
3 Correct 128 ms 15492 KB Correct
4 Correct 109 ms 15404 KB Correct
5 Correct 139 ms 15372 KB Correct
6 Correct 119 ms 15356 KB Correct
7 Correct 127 ms 15476 KB Correct
# Verdict Execution time Memory Grader output
1 Partially correct 71 ms 8604 KB B = 249998
2 Partially correct 156 ms 14392 KB B = 249996
3 Partially correct 145 ms 15508 KB B = 249223
4 Partially correct 144 ms 15536 KB B = 249993
5 Partially correct 166 ms 15740 KB B = 249999
6 Partially correct 138 ms 15616 KB B = 249997
7 Partially correct 140 ms 15588 KB B = 249465
8 Correct 115 ms 15448 KB Correct