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;
#define fast ios::sync_with_stdio(false);cin.tie(0)
#define fi first
#define se second
#define eb emplace_back
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define pre(a) cout<<fixed;cout.precision(a)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
const int inf = 1e9;
const ll INF = 1e18;
long long SendInfo(std::vector<int> W, std::vector<int> C) {
int N = W.size();
sort(all(W));
sort(all(C));
int idx = 0;
int ret = 0;
for(int i=0; i<W.size(); i++) {
while(idx < C.size() && C[idx] < W[i]) idx++;
if(C[idx] >= W[i]) ret = W[i];
}
return ret;
}
#include "vassal.h"
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false);cin.tie(0)
#define fi first
#define se second
#define eb emplace_back
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define pre(a) cout<<fixed;cout.precision(a)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
const int inf = 1e9;
const ll INF = 1e18;
int w;
set<pii> S;
void Init(long long B, std::vector<int> C){
int N = C.size();
w = B;
for(int i=0; i<C.size(); i++) {
S.insert({C[i], i});
}
}
int Maid(int W){
if(W > w) return -1;
set<pii>::iterator it = S.lower_bound({w, 0});
if(it == S.end()) return -1;
int ret = it -> se;
S.erase(it);
return ret;
}
Compilation message (stderr)
king.cpp: In function 'long long int SendInfo(std::vector<int>, std::vector<int>)':
king.cpp:27:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0; i<W.size(); i++) {
~^~~~~~~~~
king.cpp:28:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while(idx < C.size() && C[idx] < W[i]) idx++;
~~~~^~~~~~~~~~
king.cpp:21:6: warning: unused variable 'N' [-Wunused-variable]
int N = W.size();
^
vassal.cpp: In function 'void Init(long long int, std::vector<int>)':
vassal.cpp:26:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0; i<C.size(); i++) {
~^~~~~~~~~
vassal.cpp:23: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... |