#include<bits/stdc++.h>
#include "advisor.h"
using namespace std;
void ComputeAdvice(int *C, int N, int K, int M)
{
int frq[100002];
memset(frq, 0, sizeof(frq));
for(int i = 0; i < N; ++i)
frq[C[i]]++;
for(int i = 0; i < N; ++i)
{
for(int j = 1; j <= frq[i]; ++j)
WriteAdvice(0);
WriteAdvice(1);
}
}
#include<bits/stdc++.h>
#include "assistant.h"
using namespace std;
void Assist(unsigned char *A, int N, int K, int R)
{
int frq[100002];
memset(frq, 0, sizeof(frq));
int poz = 0;
for(int i = 0; i < R; ++i)
{
if(A[i] == '1')
++poz;
else
++frq[poz];
}
bool is[100002];
memset(is, 0, sizeof(is));
set<pair<int, int> >frq1;
set<pair<int, int> >frq2;
for(int i = 0; i < K; ++i)
frq1.insert({frq[i], i}), is[i] = 1;
for(int i = 0; i < N; ++i)
{
int color = GetRequest();
if(!is[color])
{
pair<int, int> p = *frq1.begin();
frq1.erase(p);
PutBack(p.second);
frq2.insert(p);
frq1.insert({frq[color], color});
frq2.erase({frq[color], color});
}
frq1.erase({frq[color], color});
--frq[color];
frq1.insert({frq[color], color});
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
1660 KB |
Output is correct |
2 |
Incorrect |
5 ms |
1652 KB |
Error - Putting back a color when it is already on the scaffold |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
13 ms |
2040 KB |
Error - Putting back a color when it is already on the scaffold |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
70 ms |
6112 KB |
Error - Putting back a color when it is already on the scaffold |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
1840 KB |
Error - Putting back a color when it is already on the scaffold |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
88 ms |
7024 KB |
Error - Not putting back color when it is not on the scaffold |
2 |
Incorrect |
92 ms |
6992 KB |
Error - Not putting back color when it is not on the scaffold |
3 |
Incorrect |
88 ms |
7244 KB |
Error - Not putting back color when it is not on the scaffold |
4 |
Incorrect |
88 ms |
7340 KB |
Error - Not putting back color when it is not on the scaffold |
5 |
Incorrect |
89 ms |
7320 KB |
Error - Not putting back color when it is not on the scaffold |
6 |
Incorrect |
87 ms |
7056 KB |
Error - Not putting back color when it is not on the scaffold |
7 |
Incorrect |
87 ms |
7436 KB |
Error - Putting back a color when it is already on the scaffold |
8 |
Incorrect |
88 ms |
7188 KB |
Error - Not putting back color when it is not on the scaffold |
9 |
Incorrect |
89 ms |
7056 KB |
Error - Not putting back color when it is not on the scaffold |
10 |
Incorrect |
145 ms |
9204 KB |
Error - Not putting back color when it is not on the scaffold |