답안 #505891

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
505891 2022-01-11T09:28:28 Z Carmel_Ab1 King of Chairs (FXCUP4_chairs) C++17
95 / 100
173 ms 14660 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/2;
}
#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=2*B+1;
    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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 492 KB Correct
2 Correct 1 ms 484 KB Correct
3 Correct 1 ms 484 KB Correct
4 Correct 0 ms 484 KB Correct
5 Correct 0 ms 484 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 68 ms 7660 KB Correct
2 Correct 140 ms 13340 KB Correct
3 Correct 122 ms 14556 KB Correct
4 Correct 102 ms 14504 KB Correct
5 Correct 133 ms 14548 KB Correct
6 Correct 103 ms 14480 KB Correct
7 Correct 102 ms 14660 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 66 ms 7860 KB B = 499996
2 Partially correct 125 ms 13412 KB B = 499993
3 Partially correct 125 ms 14592 KB B = 498446
4 Partially correct 163 ms 14656 KB B = 499986
5 Partially correct 142 ms 14580 KB B = 499998
6 Partially correct 135 ms 14576 KB B = 499995
7 Partially correct 173 ms 14520 KB B = 498931
8 Correct 121 ms 14548 KB Correct