Submission #744031

# Submission time Handle Problem Language Result Execution time Memory
744031 2023-05-18T07:23:44 Z boyliguanhan Last supper (IOI12_supper) C++17
0 / 100
289 ms 12704 KB
#include "advisor.h"
#include<bits/stdc++.h>
using namespace std;
void ComputeAdvice(int *C, int N, int K, int M) {
    int bits = log2(K);
    for(int i = 0; i < N; i++)
        for(int j = 0; j < bits; j++)
            WriteAdvice((bool)C[i]&1<<j);
}
#include "assistant.h"
#include<bits/stdc++.h>
using namespace std;
void Assist(unsigned char *A, int N, int K, int R) {

  priority_queue<pair<int, int>> q;
  int last[N], nxt[N];
  memset(last, 1, sizeof last);
  int C[N], bits = log2(K);
  for(int i = 0; i < N; i++)
    for(int j = 0; j < bits; j++)
      C[i]|=A[i*bits+j]-'0' << j;
  for(int i = N; i--;)
    nxt[i] = last[C[i]], last[C[i]] = i;
  bool on[N];
  memset(on, 0, sizeof on);
  for(int i = 0; i < K; i++)
    q.push({last[i], i}), on[i] = 1;
  for(int i = 0; i < N; i++) {
    int col = GetRequest();
    if(!on[col]) {
      PutBack(q.top().second);
      on[q.top().second] = 0;
      q.pop();
      q.push({nxt[i], col});
      on[col] = 1;
    }
  }
}

Compilation message

assistant.cpp: In function 'void Assist(unsigned char*, int, int, int)':
assistant.cpp:13:24: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   13 |       C[i]|=A[i*bits+j]-'0' << j;
      |             ~~~~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 508 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 1524 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 224 ms 10332 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 504 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 281 ms 12704 KB Output isn't correct - not an optimal way
2 Incorrect 259 ms 12596 KB Output isn't correct - not an optimal way
3 Incorrect 253 ms 12680 KB Output isn't correct - not an optimal way
4 Incorrect 257 ms 12476 KB Output isn't correct - not an optimal way
5 Incorrect 255 ms 12664 KB Output isn't correct - not an optimal way
6 Incorrect 258 ms 12564 KB Output isn't correct - not an optimal way
7 Incorrect 271 ms 12492 KB Output isn't correct - not an optimal way
8 Incorrect 257 ms 12600 KB Output isn't correct - not an optimal way
9 Incorrect 259 ms 12668 KB Output isn't correct - not an optimal way
10 Incorrect 289 ms 12532 KB Output isn't correct - not an optimal way