답안 #505902

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
505902 2022-01-11T09:32:51 Z Carmel_Ab1 King of Chairs (FXCUP4_chairs) C++17
95 / 100
175 ms 14828 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 1;
}
#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=1e9;
    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;
}

Compilation message

king.cpp: In function 'll SendInfo(vi, vi)':
king.cpp:17:9: warning: variable 'ans' set but not used [-Wunused-but-set-variable]
   17 |     int ans=0;
      |         ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 484 KB Correct
2 Correct 0 ms 484 KB Correct
3 Correct 0 ms 484 KB Correct
4 Correct 0 ms 488 KB Correct
5 Correct 0 ms 484 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 49 ms 7712 KB Correct
2 Correct 95 ms 13352 KB Correct
3 Correct 118 ms 14600 KB Correct
4 Correct 102 ms 14492 KB Correct
5 Correct 103 ms 14504 KB Correct
6 Correct 101 ms 14472 KB Correct
7 Correct 106 ms 14828 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 66 ms 7828 KB B = 1
2 Partially correct 114 ms 13384 KB B = 1
3 Partially correct 135 ms 14660 KB B = 1
4 Partially correct 175 ms 14584 KB B = 1
5 Partially correct 144 ms 14696 KB B = 1
6 Partially correct 155 ms 14588 KB B = 1
7 Partially correct 118 ms 14584 KB B = 1
8 Partially correct 115 ms 14552 KB B = 1