#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
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();
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
1044 KB |
Correct |
2 |
Incorrect |
10 ms |
1048 KB |
Wrong |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
68 ms |
5692 KB |
Wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
76 ms |
5552 KB |
Wrong |
2 |
Halted |
0 ms |
0 KB |
- |