답안 #148745

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
148745 2019-09-01T05:02:02 Z angularAndSplintered(#3752, angularAndSplintered) King of Chairs (FXCUP4_chairs) C++17
95 / 100
189 ms 15240 KB
#include "king.h"
#include <set>
#include <algorithm>
using namespace std;

long long SendInfo(std::vector<int> W, std::vector<int> C) {
	int N = W.size();

    sort(W.begin(), W.end());
    std::multiset<int> S(C.begin(), C.end());
    
    long long ans = 0;

    for(auto val : W) {
        auto it = S.lower_bound(val);
        if(it == S.end()) {
            break;
        } else {
            ans = val;
            S.erase(it);
        }
    }

    return ans;
}
#include "vassal.h"
#include <set>
using namespace std;

long long BB;
std::set<pair<int ,int>> S;

void Init(long long B, std::vector<int> C){
	int N = C.size();
    BB = B;

    for(int i = 0; i < N; i += 1) {
        S.insert(make_pair(C[i], i));
    }
}

int Maid(int W){
	if(W <= BB) {
        auto it = S.lower_bound(make_pair(W, 0));
        if(it != S.end()) {
            int ret = (*it).second;
            S.erase(it);
            return ret;
        } else {
            return -1;
        }
    } else {
        return -1;
    }
}

Compilation message

king.cpp: In function 'long long int SendInfo(std::vector<int>, std::vector<int>)':
king.cpp:7:6: warning: unused variable 'N' [-Wunused-variable]
  int N = W.size();
      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 1052 KB Correct
2 Correct 11 ms 1052 KB Correct
3 Correct 11 ms 1064 KB Correct
4 Correct 10 ms 1052 KB Correct
5 Correct 10 ms 800 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 75 ms 8148 KB Correct
2 Correct 131 ms 13788 KB Correct
3 Correct 138 ms 14712 KB Correct
4 Correct 139 ms 14976 KB Correct
5 Correct 140 ms 15068 KB Correct
6 Correct 142 ms 14972 KB Correct
7 Correct 134 ms 14972 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 96 ms 8244 KB B = 993847
2 Partially correct 172 ms 14048 KB B = 996200
3 Partially correct 163 ms 15228 KB B = 706116
4 Partially correct 180 ms 15224 KB B = 998466
5 Partially correct 183 ms 15228 KB B = 995867
6 Partially correct 189 ms 15240 KB B = 997501
7 Partially correct 159 ms 14972 KB B = 706123
8 Correct 136 ms 14976 KB Correct