//In the name of God
#include "advisor.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
const ll maxn = 2e5 + 100;
const ll mod = 1e9 + 7;
const ll inf = 1e18;
#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io freopen("input.txt", "r+", stdin);freopen("output.txt", "w+", stdout);
#define pb push_back
#define Mp make_pair
#define F first
#define S second
#define Sz(x) ll((x).size())
#define all(x) (x).begin(), (x).end()
ll a[maxn], ok[maxn], ptr[maxn], prio[maxn], ind[maxn];
vector<ll> vec[maxn];
set<pll> st;
void ComputeAdvice(int *c, int n, int k, int m){
ll lg = 0;
while((1 << lg) < k) lg++;
for(ll i = 0; i < k; i++){
a[i] = i;
ind[i] = i;
ok[i] = 1;
}
for(ll i = 0; i < n; i++){
vec[c[i]].pb(i);
}
for(ll i = 0; i < n; i++){
vec[i].pb(n);
vec[i].pb(n);
}
for(ll i = 0; i < n; i++){
prio[i] = vec[i][ptr[i]++];
st.insert(Mp(-prio[i], i));
}
for(ll i = 0; i < n; i++){
if(ok[c[i]]) continue;
ll j = st.begin()->S;
st.erase(st.begin());
prio[j] = vec[j][ptr[j]++];
st.insert(Mp(-prio[j], j));
ok[j] = 0;
ok[c[i]] = 1;
ind[c[i]] = ind[j];
for(ll o = 0; o < lg; o++){
WriteAdvice((ind[j] >> o) & 1);
//cout << ((ind[j] >> o) & 1);
}
}
}
/*int main(){
int c[100], n, k, m;
cin >> n >> k >> m;
for(ll i = 0; i < n; i++){
cin >> c[i];
}
ComputeAdvice(c, n, k, m);
}*/
//In the name of God
#include "assistant.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
const ll maxn = 2e5 + 100;
const ll mod = 1e9 + 7;
const ll inf = 1e18;
#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io freopen("input.txt", "r+", stdin);freopen("output.txt", "w+", stdout);
#define pb push_back
#define Mp make_pair
#define F first
#define S second
#define Sz(x) ll((x).size())
#define all(x) (x).begin(), (x).end()
ll a[maxn], ok[maxn];
void Assist(unsigned char *A, int n, int k, int r) {
ll lg = 0;
while((1 << lg) < k) lg++;
ll ptr = 0;
for(ll i = 0; i < k; i++){
a[i] = i;
ok[i] = 1;
}
for(ll i = 0; i < n; i++){
ll x = GetRequest();
if(ok[x]) continue;
ll y = 0;
for(ll j = 0; j < lg; j++){
y += A[ptr++] * (1 << j);
}
PutBack(a[y]);
ok[a[y]] = 0;
a[y] = x;
ok[a[y]] = 1;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
5712 KB |
Output is correct |
2 |
Incorrect |
5 ms |
5608 KB |
Error - Putting back a color that is not on the scaffold |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
27 ms |
7600 KB |
Error - Putting back a color that is not on the scaffold |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
235 ms |
25828 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
6136 KB |
Error - advice is too long |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
296 ms |
30828 KB |
Execution killed with signal 11 |
2 |
Runtime error |
294 ms |
31072 KB |
Execution killed with signal 11 |
3 |
Runtime error |
284 ms |
30900 KB |
Execution killed with signal 11 |
4 |
Runtime error |
286 ms |
30768 KB |
Execution killed with signal 11 |
5 |
Runtime error |
286 ms |
30752 KB |
Execution killed with signal 11 |
6 |
Runtime error |
290 ms |
30620 KB |
Execution killed with signal 11 |
7 |
Runtime error |
285 ms |
30648 KB |
Execution killed with signal 11 |
8 |
Runtime error |
296 ms |
30616 KB |
Execution killed with signal 11 |
9 |
Runtime error |
272 ms |
30712 KB |
Execution killed with signal 11 |
10 |
Runtime error |
422 ms |
34644 KB |
Execution killed with signal 11 |