Submission #151177

# Submission time Handle Problem Language Result Execution time Memory
151177 2019-09-02T04:05:15 Z dongwon0427 King of Chairs (FXCUP4_chairs) C++17
0 / 100
60 ms 7224 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(C.begin(), C.end());
	sort(W.begin(), W.end());


	int cidx = n-1;
	long long ans = 0;
	for(int i=n-1;i>=0;i--) {
        if(C[cidx] >= W[i]) {
            cidx--;
            ans++;
        }
	}
	return ans;
}
#include "vassal.h"
#include <bits/stdc++.h>
using namespace std;
int sz;
vector<pair<int,int>> C;

set<pair<int,int>> S;
void Init(long long B, std::vector<int> C2){
    for(int i=0;i<C2.size();i++) {
        C.push_back(pair<int,int>(C2[i],i));
    }
	sz = B;
	sort(C.begin(), C.end());

	for(int i=C.size()-1;i>=C.size()-sz;i--) {
        S.insert(C[i]);
	}
	//cout<<sz;
	// ToDo
}

int Maid(int W){
    set<pair<int,int>>::iterator it = S.lower_bound(pair<int,int>(W,-1));
    if(it == S.end()) {
        return -1;
    }
    //cout<<W<<' '<<(*it).second<<'\n';
    return (*it).second;
}

Compilation message

vassal.cpp: In function 'void Init(long long int, std::vector<int>)':
vassal.cpp:9:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<C2.size();i++) {
                 ~^~~~~~~~~~
vassal.cpp:15:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=C.size()-1;i>=C.size()-sz;i--) {
                       ~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 992 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 55 ms 7224 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 60 ms 7172 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -