Submission #148974

# Submission time Handle Problem Language Result Execution time Memory
148974 2019-09-01T05:29:08 Z 팀명못정해서15시간째고민중인팀(#3792, onjo0127, sg1774) King of Chairs (FXCUP4_chairs) C++17
100 / 100
190 ms 10444 KB
#include "king.h"
#include <bits/stdc++.h>
using namespace std;

long long SendInfo(std::vector<int> W, std::vector<int> C) {
	int N = W.size();
	sort(W.begin(), W.end());
	sort(C.begin(), C.end()); reverse(C.begin(), C.end());
	int l = 0, r = N-1;
	while(l <= r) {
        int m = l+r >> 1;
        bool f = 1;
        reverse(W.begin(), W.begin() + m + 1);
        for(int i=0; i<=m; i++) if(C[i] < W[i]) f = 0;
        reverse(W.begin(), W.begin() + m + 1);
        if(f) l = m+1;
        else r = m-1;
	}
	return 0;
}
#include "vassal.h"
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;

long long BB;
set<pii> st;
int c = 0;

void Init(long long B, std::vector<int> C){
	int N = C.size();
	BB = B;
	for(int i=0; i<N; i++) st.insert({C[i], i});
}

int Maid(int W) {
    //if(1LL*W > BB) return -1;
    auto it = st.lower_bound({W, -1});
    if(it == st.end()) return -1;
    st.erase(it);
    return (*it).second;
}

Compilation message

king.cpp: In function 'long long int SendInfo(std::vector<int>, std::vector<int>)':
king.cpp:11:18: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
         int m = l+r >> 1;
                 ~^~
# Verdict Execution time Memory Grader output
1 Correct 10 ms 516 KB Correct
2 Correct 10 ms 1044 KB Correct
3 Correct 10 ms 1144 KB Correct
4 Correct 10 ms 1044 KB Correct
5 Correct 10 ms 784 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 68 ms 5684 KB Correct
2 Correct 110 ms 9628 KB Correct
3 Correct 119 ms 10436 KB Correct
4 Correct 122 ms 10436 KB Correct
5 Correct 121 ms 10440 KB Correct
6 Correct 118 ms 10180 KB Correct
7 Correct 122 ms 10440 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 82 ms 6032 KB Correct
2 Correct 159 ms 9624 KB Correct
3 Correct 143 ms 10444 KB Correct
4 Correct 170 ms 10440 KB Correct
5 Correct 190 ms 10440 KB Correct
6 Correct 173 ms 10180 KB Correct
7 Correct 141 ms 10432 KB Correct
8 Correct 135 ms 10428 KB Correct