#include "king.h"
#include <algorithm>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
long long SendInfo(std::vector<int> W, std::vector<int> C) {
int N = W.size();
vector<pii> ws, cs;
for(int i=0;i<N;i++) {
cs.push_back({C[i], i});
}
sort(cs.begin(), cs.end());
for(int i=0;i<N;i++) {
ws.push_back({W[i], i});
}
sort(ws.begin(), ws.end());
int *ans = new int[1 << 17];
int wi=0;
int ci=0;
for(;wi<N && ci<N;) {
while(ci<N && ws[wi].first>cs[ci].first) {
ci++;
}
if(ci==N) break;
ans[ws[wi].second] = cs[ci].second;
wi++; ci++;
}
for(int i=wi;i<N;i++)
ans[ws[i].second] = -1;
return ((unsigned long long)ans % (1ll << 24)) >> 8;
}
#include "vassal.h"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int *ans;
void Init(long long B, std::vector<int> C){
int N = C.size();
ans = new int[1 << 17];
int *past = (int*)((((ull)ans >> 24) << 24) ^ (B << 8));
for(int i = 0, im = (1 << 17); i < im; i++)
ans[i] = past[i];
}
int Maid(int W){
int ret = *ans;
ans++;
return ret;
}
Compilation message
vassal.cpp: In function 'void Init(long long int, std::vector<int>)':
vassal.cpp:10:6: warning: unused variable 'N' [-Wunused-variable]
int N = C.size();
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
11 ms |
1040 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
56 ms |
4960 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
59 ms |
4320 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |