Submission #26684

# Submission time Handle Problem Language Result Execution time Memory
26684 2017-07-04T17:05:52 Z samir_droubi Last supper (IOI12_supper) C++14
0 / 100
164 ms 19736 KB
#include "advisor.h"
#include <bits/stdc++.h>
using namespace std;
void ComputeAdvice(int *C, int N, int K, int M)
{
    const int mxn=(1e5)+5;
    bool ans[mxn*2];
    int ord[mxn];

    for(int i=0;i<K;++i)ord[i]=-1;

    set<pair<int,int> >s;

    vector<int>v[mxn];

    for(int i=0;i<N;++i)
      v[C[i]].push_back(i);

    for(int i=0;i<N;++i)
      v[i].push_back(N);

    for(int i=0;i<N;++i)
      reverse(v[i].begin(),v[i].end());

    for(int i=0;i<K;++i)
    {
      s.insert({v[i].back(),i});
      v[i].pop_back();
    }
    for(int i=0;i<N;++i)
    {
      if(s.count({i,C[i]}))
      {
        if(ord[C[i]]!=-1)ans[ord[C[i]]+N]=true;
        else ans[C[i]]=true;
      }
      else
      {
        set<pair<int,int> >::iterator it=s.end();
        --it;
        s.erase(it);
      }
      ord[C[i]]=i;
      s.insert({v[C[i]].back(),C[i]});
      v[C[i]].pop_back();
    }
    for(int i=0;i<2*N;++i)
      WriteAdvice(ans[i]);
}
#include "assistant.h"
#include <bits/stdc++.h>
using namespace std;
void Assist(unsigned char *A, int N, int K, int R)
{
  const int mxn=(1e5)+5;
  vector<int>del;
  bool sc[mxn];
  for(int i=0;i<K;++i)
  {
    if(A[i]==0)del.push_back(i);
    sc[i]=true;
  }
  int it=0;
  for(int i=0;i<N;++i)
  {
    int r=GetRequest();
    if(sc[r])continue;
    if(A[r+N]==0)del.push_back(r);
    sc[del[it]]=false;
    PutBack(del[it]);
    ++it;
    sc[r]=true;
  }
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 5360 KB Output is correct
2 Incorrect 5 ms 5576 KB Output isn't correct - not an optimal way
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 6984 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 131 ms 16632 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 16632 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 139 ms 18784 KB Error - Not putting back color when it is not on the scaffold
2 Incorrect 145 ms 19104 KB Error - Not putting back color when it is not on the scaffold
3 Incorrect 152 ms 19376 KB Error - Not putting back color when it is not on the scaffold
4 Incorrect 150 ms 19392 KB Error - Not putting back color when it is not on the scaffold
5 Incorrect 146 ms 19648 KB Error - Not putting back color when it is not on the scaffold
6 Incorrect 161 ms 19680 KB Error - Not putting back color when it is not on the scaffold
7 Incorrect 159 ms 19680 KB Error - Not putting back color when it is not on the scaffold
8 Incorrect 164 ms 19680 KB Error - Not putting back color when it is not on the scaffold
9 Incorrect 143 ms 19736 KB Error - Not putting back color when it is not on the scaffold
10 Incorrect 156 ms 19736 KB Error - Not putting back color when it is not on the scaffold