답안 #26810

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
26810 2017-07-06T06:30:48 Z samir_droubi 최후의 만찬 (IOI12_supper) C++14
0 / 100
91 ms 27840 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];
    bool sc[mxn];
    int ord[mxn];

    vector<int>v[mxn];
    set<pair<int,int> >s;

    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);
      reverse(v[i].begin(),v[i].end());
    }
    for(int i=0;i<K;++i)
    {
      ord[i]=-1;
      sc[i]=true;
      s.insert({v[i].back(),i});
      v[i].pop_back();
    }

    for(int i=0;i<N;++i)
    {
      if(sc[C[i]])
      {
        s.erase({i,C[i]});
        if(ord[C[i]]==-1)ans[C[i]]=true;
        else ans[ord[i+N]]=true;
      }
      else
      {
        set<pair<int,int> >::iterator it=s.end();
        --it;
        sc[it->second]=false;
        s.erase(it);
        sc[C[i]]=true;
      }
      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(A[i+N]==0)del.push_back(r);
    if(sc[r])continue;
    sc[del[it]]=false;
    PutBack(del[it]);
    ++it;
    sc[r]=true;
  }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 5360 KB Output is correct
2 Incorrect 6 ms 5576 KB Error - Putting back a color that is not on the scaffold
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 18 ms 7296 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 46 ms 13920 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 10 ms 27840 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 60 ms 15556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 59 ms 15812 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 50 ms 16048 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 71 ms 16084 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 48 ms 16084 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 48 ms 16084 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 48 ms 16084 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 58 ms 16084 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 49 ms 16084 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 91 ms 16084 KB Execution killed with signal 11 (could be triggered by violating memory limits)