#include <bits/stdc++.h>
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")
#include "advisor.h"
using namespace std;
using ll = long long;
using ii = pair<ll, ll>;
#define ff first
#define ss second
#define pb push_back
/// #define int ll
const int MOD = 1e9 + 7;
void ComputeAdvice(int C[], int N, int K, int M) {
int k = ceil(log2(N));
for(int l = 0; l < N; l++) {
for(int i = 0; i <= k; i++) {
if(C[l] & (1 << i))
WriteAdvice(1);
else WriteAdvice(0);
}
}
}
#include <bits/stdc++.h>
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")
#include "assistant.h"
using namespace std;
using ll = long long;
using ii = pair<ll, ll>;
#define ff first
#define ss second
#define pb push_back
/// #define int ll
const int MOD = 1e9 + 7;
int arr[5001], pw[31], k;
vector<int> num[5001];
int GetRequest();
void PutBack(int T);
void Assist(unsigned char *A, int N, int K, int R) {
int i; k = ceil(log2(N)); int v = 1;
for(int l = 0; l <= k; l++)
pw[l] = v, v *= 2;
int m = sizeof(A);
for(int l = 0; l < m; l++) {
int val = 0;
for(i = 0; i <= k; i++) {
if(A[l + i] == '0') continue;
val += pw[k - i];
}
arr[val]++; num[val].pb(l); l += k;
}
set<int> curr;
for(int l = 0; l < K; l++) curr.insert(l);
for (i = 0; i < N; i++) {
int req = GetRequest();
if(curr.count(req)) continue;
int in = -1;
for(int l = 0; l < N; l++) {
if(!curr.count(l)) continue;
if(arr[l] == 0) {
in = l; break;
}
}
if(in != -1) {
PutBack(in); curr.erase(in);
curr.insert(req); arr[req]--; continue;
}
int s = -1;
for(int l = 0; l < N; l++) {
if(!curr.count(l)) continue;
if(*num[l].begin() > s) {
s = *num[l].begin(), in = l;
}
}
PutBack(in); curr.erase(in);
curr.insert(req); arr[req]--;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
896 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
31 ms |
2300 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
278 ms |
13872 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
784 KB |
Error - advice is too long |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
343 ms |
17248 KB |
Execution killed with signal 11 |
2 |
Runtime error |
381 ms |
17144 KB |
Execution killed with signal 11 |
3 |
Runtime error |
344 ms |
17116 KB |
Execution killed with signal 11 |
4 |
Runtime error |
346 ms |
17116 KB |
Execution killed with signal 11 |
5 |
Runtime error |
351 ms |
17124 KB |
Execution killed with signal 11 |
6 |
Runtime error |
380 ms |
17160 KB |
Execution killed with signal 11 |
7 |
Runtime error |
363 ms |
17128 KB |
Execution killed with signal 11 |
8 |
Runtime error |
390 ms |
17244 KB |
Execution killed with signal 11 |
9 |
Runtime error |
380 ms |
17124 KB |
Execution killed with signal 11 |
10 |
Runtime error |
350 ms |
17144 KB |
Execution killed with signal 11 |