This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "king.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
long long SendInfo(std::vector<int> W, std::vector<int> C) {
vector<pair<int,int> > orig ;
for(int i = 0 ; i < W.size() ; i ++) orig.push_back(pair<int,int>(C[i] , i));
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() < W[i]){
C.pop_back();
}
// cout<<i<<" " << C.back() << endl;
if(!C.size()){
last = W[i];
break;
}
else{
C.pop_back();
}
}
bool jafoi = false;
sort(orig.begin() , orig.end());
for(int i = 0 ; i < W.size() ; i ++){
if(orig[i].first > last){
jafoi = true;
last = orig[i].second + 1;
}
}
if(!jafoi) last = 0;
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;
int cntX = 0;
bool jafoi = false;
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));
if(u == Sx.end()){
return -1;
}
pii X = *u;
Sx.erase(X);
// cout<<W<<" " <<X.second << endl;
return X.second;
}
}
Compilation message (stderr)
king.cpp: In function 'long long int SendInfo(std::vector<int>, std::vector<int>)':
king.cpp:9:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0 ; i < W.size() ; i ++) orig.push_back(pair<int,int>(C[i] , i));
~~^~~~~~~~~~
king.cpp:13:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0 ; i < W.size() ; i ++){
~~^~~~~~~~~~~
king.cpp:28: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:16:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i =0 ; i < C.size() ; i ++){
~~^~~~~~~~~~
vassal.cpp:13:6: warning: unused variable 'N' [-Wunused-variable]
int N = C.size();
^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |