#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);
is[p.second] = 0;
is[color] = 1;
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 |
5 ms |
1520 KB |
Output is correct |
2 |
Incorrect |
4 ms |
1528 KB |
Output isn't correct - not an optimal way |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
19 ms |
2452 KB |
Output isn't correct - not an optimal way |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
152 ms |
7156 KB |
Output isn't correct - not an optimal way |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
10 ms |
1940 KB |
Output isn't correct - not an optimal way |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
198 ms |
8252 KB |
Output isn't correct - not an optimal way |
2 |
Incorrect |
198 ms |
8348 KB |
Output isn't correct - not an optimal way |
3 |
Incorrect |
205 ms |
8272 KB |
Output isn't correct - not an optimal way |
4 |
Incorrect |
197 ms |
8216 KB |
Output isn't correct - not an optimal way |
5 |
Incorrect |
206 ms |
8176 KB |
Output isn't correct - not an optimal way |
6 |
Incorrect |
200 ms |
8344 KB |
Output isn't correct - not an optimal way |
7 |
Incorrect |
199 ms |
8380 KB |
Output isn't correct - not an optimal way |
8 |
Incorrect |
203 ms |
8320 KB |
Output isn't correct - not an optimal way |
9 |
Incorrect |
204 ms |
8244 KB |
Output isn't correct - not an optimal way |
10 |
Incorrect |
185 ms |
9600 KB |
Output isn't correct - not an optimal way |