답안 #149416

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

using namespace std;

long long SendInfo(std::vector<int> W, std::vector<int> C) {
    return 0LL;
}
#include "vassal.h"
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <deque>
using namespace std;

//vector<pair<int,int>> C_rev;
//vector<pair<int,int>> C_;

map<int,deque<int>> s;
void Init(long long B, std::vector<int> C){
    for (int i = 0 ; i < (int)C.size();i++) {
        
        if(s.count(C[i]) == 0) {
            s[C[i]] = deque<int>();
        }
        s[C[i]].push_back(i);
    }
}

int Maid(int W){
    auto it = s.lower_bound(W);
    if(it!=s.end()) {
        if (!(it->second).empty()) {
            int x = (it->second).front();
            (it->second).pop_front();
            if((it->second).empty()){
                s.erase(it);
            }
            return x;
        }
    } else {
        return -1;
    }
}

Compilation message

vassal.cpp: In function 'int Maid(int)':
vassal.cpp:37:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 1056 KB Correct
2 Correct 10 ms 1060 KB Correct
3 Correct 11 ms 760 KB Correct
4 Correct 10 ms 1052 KB Correct
5 Correct 10 ms 1048 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 106 ms 39548 KB Correct
2 Correct 182 ms 68012 KB Correct
3 Correct 204 ms 73296 KB Correct
4 Correct 198 ms 74316 KB Correct
5 Correct 191 ms 74304 KB Correct
6 Correct 191 ms 74192 KB Correct
7 Correct 208 ms 73168 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 140 ms 39472 KB Correct
2 Correct 295 ms 68520 KB Correct
3 Correct 239 ms 73180 KB Correct
4 Correct 330 ms 74328 KB Correct
5 Correct 323 ms 74320 KB Correct
6 Correct 287 ms 74324 KB Correct
7 Correct 256 ms 73164 KB Correct
8 Correct 194 ms 66136 KB Correct