#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, -1});
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 |
10 ms |
536 KB |
Correct |
2 |
Correct |
10 ms |
1044 KB |
Correct |
3 |
Correct |
11 ms |
1048 KB |
Correct |
4 |
Correct |
10 ms |
1048 KB |
Correct |
5 |
Correct |
11 ms |
972 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
69 ms |
5688 KB |
Correct |
2 |
Correct |
117 ms |
9600 KB |
Correct |
3 |
Correct |
127 ms |
10448 KB |
Correct |
4 |
Correct |
127 ms |
10444 KB |
Correct |
5 |
Correct |
127 ms |
9920 KB |
Correct |
6 |
Correct |
129 ms |
10440 KB |
Correct |
7 |
Correct |
123 ms |
10436 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
87 ms |
5948 KB |
B = 999992 |
2 |
Partially correct |
156 ms |
9624 KB |
B = 999980 |
3 |
Partially correct |
148 ms |
10432 KB |
B = 996891 |
4 |
Partially correct |
169 ms |
10436 KB |
B = 999968 |
5 |
Partially correct |
187 ms |
10176 KB |
B = 999982 |
6 |
Partially correct |
175 ms |
10444 KB |
B = 999987 |
7 |
Partially correct |
142 ms |
10432 KB |
B = 997852 |
8 |
Correct |
126 ms |
10448 KB |
Correct |