답안 #149056

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
149056 2019-09-01T05:39:16 Z usa1+samsung2(#3703, adman, nona1314, wowoto9772) King of Chairs (FXCUP4_chairs) C++17
0 / 100
69 ms 4952 KB
#include "king.h"
#include <algorithm>
#include <vector>
#include <utility>
#include <iostream>

using namespace std;

long long SendInfo(std::vector<int> W, std::vector<int> C) {
    long long ret = 0;
    vector<pair<int,int>> C_;
    for(const auto &i : C) {
        C_.emplace_back(i, 0);
    }
    for(const auto& w : W) {
        auto it = upper_bound(C_.begin(), C_.end(), pair<int,int>(w,0));
        if (it == C_.begin()) continue;
        it--;
        if ((it->first) >= w && (it->second) != 1) {
            it->second = 1;
            ret++;
        }
    }
    //cout << "King : " << ret << endl;;
    return ret;
}
#include "vassal.h"
#include <vector>
#include <utility>
#include <algorithm>
#include <iostream>

using namespace std;

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

int Maid(int W){
    auto it = upper_bound(C_.begin(), C_.end(), pair<int,int>(W,0));
    if (it!=C_.begin()) {
        it--;
        if ((it->first) >= W && (it->second) != 1) {
            int i = it-C_.begin();
            it->second = 1;
            //cout << "va: " << C_rev[i].second << endl;
            return (C_rev[i].second);
        }
    }
    //cout << "va: " << -1 << endl;
    return -1;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 1052 KB Wrong
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 61 ms 4828 KB Wrong
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 69 ms 4952 KB Wrong
2 Halted 0 ms 0 KB -