답안 #148663

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
148663 2019-09-01T04:53:18 Z usa1+samsung2(#3703, adman, nona1314, wowoto9772) King of Chairs (FXCUP4_chairs) C++17
17 / 100
1000 ms 1152 KB
#include "king.h"
#include <algorithm>
#include <vector>

using namespace std;

long long SendInfo(std::vector<int> W, std::vector<int> C) {
    int N = C.size();
    vector<bool> x(N, false);
    long long ret = 0;
    sort(C.begin(), C.end());
    for(const auto& w : W) {
        auto it = lower_bound(C.begin(), C.end(), w);
        while (it!=C.end()) {
            int i = it-C.begin();
            if(!x[i]) {
                x[i] = true;
                ret++;
            }
            it++;
        }
    }
    return ret;
}
#include "vassal.h"
#include <vector>
#include <utility>
#include <algorithm>
#include <tuple>

using namespace std;

long long BB;
vector<tuple<int,int>> C_rev;
vector<int> C_;
vector<bool> x;
void Init(long long B, std::vector<int> C){
    x = vector<bool>(C.size(), false);
    for(int i = 0 ; i < C.size(); i++) {
        C_rev.emplace_back(C[i], i);
    }
    C_ = move(C);
    sort(C_.begin(), C_.end());
    sort(C_rev.begin(), C_rev.end());
}

int Maid(int W){
    auto it = lower_bound(C_.begin(), C_.end(), W);
    while (it!=C_.end()) {
        int i = it-C_.begin();
        if(!x[i]) {
            x[i] = true;
            return get<1>(C_rev[i]);
        }
        it++;
    }
    return -1;
}

Compilation message

vassal.cpp: In function 'void Init(long long int, std::vector<int>)':
vassal.cpp:15:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0 ; i < C.size(); i++) {
                     ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 1056 KB Correct
2 Correct 11 ms 1060 KB Correct
3 Correct 10 ms 548 KB Correct
4 Correct 10 ms 1056 KB Correct
5 Correct 11 ms 1060 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1099 ms 1152 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1099 ms 1152 KB Time limit exceeded
2 Halted 0 ms 0 KB -