Submission #272392

# Submission time Handle Problem Language Result Execution time Memory
272392 2020-08-18T11:39:39 Z sjimed Last supper (IOI12_supper) C++14
0 / 100
271 ms 141552 KB
#include "advisor.h"
#include<bits/stdc++.h>
using namespace std;

#define fast ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()
#define em emplace
#define eb emplace_back
#define mp make_pair

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll INF = 1e18;
const int inf = 1e9;

static queue<int> q[100010];
static set<pii> s;
static bool ans[200010];

void ComputeAdvice(int *C, int N, int K, int M) {
  
  for(int i=0; i<N; i++) {
    q[C[i]].em(i);
  }

  for(int i=0; i<N; i++)
    q[i].em(N);

  for(int i=0; i<K; i++) {
    s.insert(mp(q[i].front(), i));
  }

  for(int i=0; i<N; i++) {
    if(s.begin()->fi == i) {
      s.erase(s.begin());
      
      q[C[i]].pop();
      s.insert(mp(q[C[i]].front(), i + K));
    }
    else {
      int x = prev(s.end())->se;
      ans[x] = true;

      s.erase(prev(s.end()));

      q[C[i]].pop();
      s.insert(mp(q[C[i]].front(), i + K));
    }
  }

  for(int i=0; i<N+K; i++) {
    WriteAdvice(ans[i]);
  }
}
#include "assistant.h"
#include<bits/stdc++.h>
using namespace std;

#define fast ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()
#define em emplace
#define eb emplace_back
#define mp make_pair

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll INF = 1e18;
const int inf = 1e9;

static int n;
static set<int> t, s;

void Assist(unsigned char *A, int N, int K, int R) {
  n = N;

  for(int i=0; i<K; i++) {
    if(A[i]) s.insert(i);
    t.insert(i);
  }

  for(int i = K; i < N + K; i++) {
    int x = GetRequest();

    if(t.find(x) == t.end()) {
      t.insert(x);

      int y = *s.begin();
      s.erase(y);

      PutBack(y);
    }
    
    if(A[i]) s.insert(x);
  }
}
# Verdict Execution time Memory Grader output
1 Correct 50 ms 135152 KB Output is correct
2 Correct 60 ms 135168 KB Output is correct
3 Correct 61 ms 135472 KB Output is correct
4 Incorrect 62 ms 135416 KB Error - Not putting back color when it is not on the scaffold
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 64 ms 135664 KB Error - Not putting back color when it is not on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 204 ms 139376 KB Output is correct
2 Correct 230 ms 141552 KB Output is correct
3 Correct 230 ms 141552 KB Output is correct
4 Correct 226 ms 141552 KB Output is correct
5 Incorrect 219 ms 141040 KB Error - Not putting back color when it is not on the scaffold
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 55 ms 135408 KB Output is correct
2 Incorrect 57 ms 135664 KB Output isn't correct - not an optimal way
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 229 ms 140016 KB Error - Not putting back color when it is not on the scaffold
2 Correct 258 ms 140208 KB Output is correct - 122000 bits used
3 Correct 254 ms 140720 KB Output is correct - 125000 bits used
4 Correct 255 ms 140736 KB Output is correct - 125000 bits used
5 Correct 256 ms 140784 KB Output is correct - 125000 bits used
6 Correct 271 ms 140528 KB Output is correct - 125000 bits used
7 Correct 252 ms 140528 KB Output is correct - 124828 bits used
8 Correct 236 ms 140528 KB Output is correct - 124910 bits used
9 Correct 231 ms 141040 KB Output is correct - 125000 bits used
10 Incorrect 225 ms 140528 KB Error - Not putting back color when it is not on the scaffold