# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
150087 |
2019-09-01T07:41:47 Z |
Solo Leveling (#3786, wzy) |
King of Chairs (FXCUP4_chairs) |
C++17 |
|
87 ms |
6464 KB |
#include "king.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define F first
#define S second
long long SendInfo(std::vector<int> W, std::vector<int> C) {
vector<pii> c;
int cc = 0;
for(auto w : C) c.push_back(pii(w, cc++));
sort(W.begin() , W.end());
sort(c.rbegin() , c.rend());
ll last = 0LL;
for(int i = 0 ; i < W.size() ; i ++){
while(c.size() && c.back().first < W[i]){
c.pop_back();
}
// cout<<i<<" " << C.back() << endl;
if(!c.size()){
break;
}
else{
last = c.back().second + 1;
c.pop_back();
}
}
return last;
}
#include "vassal.h"
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define F first
#define S second
long long BB;
vector<int> c;
set<pii> Sx;
void Init(long long B, std::vector<int> C){
int N = C.size();
BB = B;
c = C;
for(int i =0 ; i < C.size() ; i ++){
Sx.insert(pair<int,int>(C[i] , i));
}
// ToDo
}
int Maid(int W){
if(( BB != 0 && W > c[BB-1]) || (W > c.back())){
return -1;
}
else{
auto u = Sx.lower_bound(pii(W , -1));
pii X = *u;
Sx.erase(X);
// cout<<W<<" " <<X.second << endl;
return X.second;
}
}
Compilation message
king.cpp: In function 'long long int SendInfo(std::vector<int>, std::vector<int>)':
king.cpp:16:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0 ; i < W.size() ; i ++){
~~^~~~~~~~~~~
vassal.cpp: In function 'void Init(long long int, std::vector<int>)':
vassal.cpp:15:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i =0 ; i < C.size() ; i ++){
~~^~~~~~~~~~
vassal.cpp:12:6: warning: unused variable 'N' [-Wunused-variable]
int N = C.size();
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
1048 KB |
Correct |
2 |
Runtime error |
10 ms |
972 KB |
Execution failed because the return code was nonzero |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
69 ms |
6232 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
87 ms |
6464 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |