Submission #271203

# Submission time Handle Problem Language Result Execution time Memory
271203 2020-08-18T05:08:05 Z 임성재(#5104) Last supper (IOI12_supper) C++14
8 / 100
483 ms 148808 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 vector<int> ans;

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) {
      int x = s.begin()->se;
      q[x].pop();

      s.erase(s.begin());
      s.insert(mp(q[x].front(), x));

      ans.eb(N);
    }
    else {
      int x = prev(s.end())->se;
      s.erase(prev(s.end()));

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

      ans.eb(x);
    }
  }

  for(auto i : ans) {
    for(int j=0; j<13; j++) {
      if(i & (1<<j)) WriteAdvice(1);
      else WriteAdvice(0);
    }
  }
}
#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;

void Assist(unsigned char *A, int N, int K, int R) {
  for(int i=0; i<N; i++) {
    int b = 0;
    for(int j=0; j<13; j++) {
      if(A[i*13 + j]) b |= (1<<j);
    }

    GetRequest();

    if(b < N) PutBack(b);
  }
}
# Verdict Execution time Memory Grader output
1 Correct 53 ms 135152 KB Output is correct
2 Correct 53 ms 135152 KB Output is correct
3 Correct 55 ms 135408 KB Output is correct
4 Correct 62 ms 135680 KB Output is correct
5 Correct 69 ms 135920 KB Output is correct
6 Correct 71 ms 135936 KB Output is correct
7 Correct 70 ms 135920 KB Output is correct
8 Correct 71 ms 135920 KB Output is correct
9 Correct 70 ms 136176 KB Output is correct
10 Correct 72 ms 135920 KB Output is correct
11 Correct 69 ms 135936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 93 ms 136688 KB Error - Putting back a color when it is already on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 361 ms 145952 KB Error - Putting back a color when it is already on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 56 ms 135664 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 446 ms 147944 KB Error - Putting back a color when it is already on the scaffold
2 Incorrect 454 ms 148448 KB Error - Putting back a color when it is already on the scaffold
3 Incorrect 438 ms 148808 KB Error - Putting back a color when it is already on the scaffold
4 Incorrect 438 ms 148512 KB Error - Putting back a color when it is already on the scaffold
5 Incorrect 432 ms 148632 KB Error - Putting back a color when it is already on the scaffold
6 Incorrect 431 ms 148448 KB Error - Putting back a color when it is already on the scaffold
7 Incorrect 431 ms 148712 KB Error - Putting back a color when it is already on the scaffold
8 Incorrect 459 ms 148456 KB Error - Putting back a color when it is already on the scaffold
9 Incorrect 483 ms 148464 KB Error - Putting back a color when it is already on the scaffold
10 Incorrect 425 ms 148448 KB Error - Putting back a color when it is already on the scaffold