Submission #271214

# Submission time Handle Problem Language Result Execution time Memory
271214 2020-08-18T05:13:23 Z 임성재(#5104) Last supper (IOI12_supper) C++14
20 / 100
589 ms 151784 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;
static int mx;

void ComputeAdvice(int *C, int N, int K, int M) {
  while(N >> mx) mx++;

  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<mx; 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;

static int mx;

void Assist(unsigned char *A, int N, int K, int R) {
  while(N >> mx) mx++;

  for(int i=0; i<N; i++) {
    int b = 0;
    for(int j=0; j<mx; j++) {
      if(A[i*mx + j]) b |= (1<<j);
    }

    GetRequest();

    if(b < N) PutBack(b);
  }
}
# Verdict Execution time Memory Grader output
1 Correct 54 ms 135408 KB Output is correct
2 Correct 54 ms 135152 KB Output is correct
3 Correct 55 ms 135392 KB Output is correct
4 Correct 62 ms 135664 KB Output is correct
5 Correct 69 ms 135920 KB Output is correct
6 Correct 71 ms 135920 KB Output is correct
7 Correct 70 ms 135928 KB Output is correct
8 Correct 71 ms 135928 KB Output is correct
9 Correct 71 ms 135920 KB Output is correct
10 Correct 71 ms 135920 KB Output is correct
11 Correct 71 ms 136184 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 91 ms 136688 KB Output is correct
2 Correct 281 ms 142064 KB Output is correct
3 Correct 542 ms 151784 KB Output is correct
4 Correct 537 ms 148456 KB Output is correct
5 Correct 572 ms 148456 KB Output is correct
6 Correct 566 ms 149216 KB Output is correct
7 Correct 529 ms 150392 KB Output is correct
8 Correct 479 ms 148704 KB Output is correct
9 Correct 503 ms 148200 KB Output is correct
10 Correct 569 ms 151360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 455 ms 147680 KB Output is correct
2 Incorrect 146 ms 143328 KB Error - advice is too long
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 53 ms 135408 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 554 ms 150416 KB Output is partially correct - 1700000 bits used
2 Correct 588 ms 150496 KB Output is partially correct - 1700000 bits used
3 Correct 555 ms 150752 KB Output is partially correct - 1700000 bits used
4 Correct 561 ms 150752 KB Output is partially correct - 1700000 bits used
5 Correct 562 ms 150752 KB Output is partially correct - 1700000 bits used
6 Correct 589 ms 150880 KB Output is partially correct - 1700000 bits used
7 Correct 556 ms 150704 KB Output is partially correct - 1697263 bits used
8 Correct 569 ms 150768 KB Output is partially correct - 1700000 bits used
9 Correct 554 ms 150752 KB Output is partially correct - 1700000 bits used
10 Correct 556 ms 150752 KB Output is partially correct - 1700000 bits used