답안 #272078

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
272078 2020-08-18T08:39:47 Z 최은수(#5096) 최후의 만찬 (IOI12_supper) C++14
0 / 100
2500 ms 1656 KB
#include"advisor.h"
#include<iostream>
#include<vector>
#include<set>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e9+7;
const ll INF=1e18;
void ComputeAdvice(int*C,int N,int K,int M)
{
    set<pi,greater<pi> >st;
    vector<int>v(N,N);
    vector<int>nx=v;
    vector<bool>chk(N,0);
    for(int i=N;i-->0;)
        nx[i]=v[C[i]],v[C[i]]=i;
    for(int i=0;i<K;i++)
    {
        int cnt=0;
        for(int j=0;j<nx[i];j++)
            if(!chk[C[j]])
                cnt++,chk[C[j]]=1;
        if(cnt<K)
            WriteAdvice(1);
        else
            WriteAdvice(0);
        for(int j=0;j<nx[i];j++)
            chk[C[j]]=0;
    }
    for(int i=0;i<N;i++)
    {
        if(nx[i]==N)
            WriteAdvice(0);
        else
        {
            int cnt=0;
            for(int j=i+1;j<nx[i];j++)
                if(!chk[C[j]])
                    cnt++,chk[C[j]]=1;
            if(cnt<K)
                WriteAdvice(1);
            else
                WriteAdvice(0);
            for(int j=i+1;j<nx[i];j++)
                chk[C[j]]=0;
        }
    }
    return;
}
#include"assistant.h"
#include<iostream>
#include<vector>
#include<set>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e9+7;
const ll INF=1e18;
void Assist(unsigned char*A,int N,int K,int R)
{
    set<int>v1,v2;
    for(int i=0;i<K;i++)
        (A[i]==1?v1:v2).ep(i);
    for(int i=0;i<N;i++)
    {
        int c=GetRequest();
        auto it=v1.find(c);
        if(it==v1.end())
        {
            PutBack(*v2.begin());
            v2.erase(v2.begin());
        }
        else
            v1.erase(it);
        (A[i+K]==1?v1:v2).ep(c);
    }
    return;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 780 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 204 ms 1092 KB Error - Putting back a color when it is already on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2576 ms 1400 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 45 ms 932 KB Error - Putting back a color when it is already on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2568 ms 1536 KB Time limit exceeded
2 Execution timed out 2577 ms 1656 KB Time limit exceeded
3 Execution timed out 2575 ms 1572 KB Time limit exceeded
4 Execution timed out 2569 ms 1656 KB Time limit exceeded
5 Execution timed out 2574 ms 1564 KB Time limit exceeded
6 Execution timed out 2584 ms 1568 KB Time limit exceeded
7 Execution timed out 2532 ms 1576 KB Time limit exceeded
8 Execution timed out 2584 ms 1568 KB Time limit exceeded
9 Execution timed out 2579 ms 1536 KB Time limit exceeded
10 Execution timed out 2544 ms 1536 KB Time limit exceeded