Submission #349677

# Submission time Handle Problem Language Result Execution time Memory
349677 2021-01-18T07:14:19 Z beksultan04 Last supper (IOI12_supper) C++14
0 / 100
443 ms 15256 KB
#include "advisor.h"
#include <bits/stdc++.h>
#ifndef EVAL
#include "grader.cpp"
#endif
using namespace std;
#define lol long long
#define pii pair<int,int>
#define OK puts("OK");
#define NO puts("NO");
#define YES puts("YES");
#define fr first
#define sc second
#define ret return
#define scanl(a) scanf("%lld",&a);
#define scanll(a,b) scanf("%lld %lld",&a, &b);
#define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c);
#define scan1(a) scanf("%d",&a);
#define scan2(a,b) scanf("%d %d",&a, &b);
#define scan3(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define all(s) s.begin(),s.end()
#define allr(s) s.rbegin(),s.rend()
#define pb push_back
#define sz(v) (int)v.size()
#define endi puts("");
#define eps 1e-12
int vis[100001],predok[100001],is[100001],INF = 1e9+7;
void ComputeAdvice(int *c, int N, int K, int M) {
    int i,n = 18,j;
    priority_queue <pii> q;
    for (i=0;i<N;++i){
        vis[i] = INF;
    }
    for (i=N-1;i>=0;--i){
        predok[i] = vis[c[i]];
        vis[c[i]] = i;
    }
    for (i=0;i<K;++i){
        q.push({vis[i],i});
        is[i]=1;
    }
    for (j=0;j<N;++j){
        if (is[c[j]]){
            for (i=0;i<n;++i)WriteAdvice(1);
        }
        else {
            int x = q.top().sc;q.pop();
            is[x] = 0;
            for (i=0;i<n;++i){
                if ((x&(1<<i)))WriteAdvice(1);
                else WriteAdvice(0);
            }
            is[c[j]]=1;
            q.push({predok[j],c[j]});
        }
    }
}







#include "assistant.h"
#include <bits/stdc++.h>
#ifndef EVAL
#include "grader.cpp"
#endif
using namespace std;
#define lol long long
#define pii pair<int,int>
#define OK puts("OK");
#define NO puts("NO");
#define YES puts("YES");
#define fr first
#define sc second
#define ret return
#define scanl(a) scanf("%lld",&a);
#define scanll(a,b) scanf("%lld %lld",&a, &b);
#define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c);
#define scan1(a) scanf("%d",&a);
#define scan2(a,b) scanf("%d %d",&a, &b);
#define scan3(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define all(s) s.begin(),s.end()
#define allr(s) s.rbegin(),s.rend()
#define pb push_back
#define sz(v) (int)v.size()
#define endi puts("");
#define eps 1e-12

void Assist(unsigned char *A, int N, int K, int R) {

    int i,n = 18,j,ans;
    for (i = 0; i < R; i +=n) {
        ans = 0;
        for (j = 0;j<n;++j){
            int req = A[i+j];
            if (req){
                ans += (1<<j);
            }
        }
        int req = GetRequest();
        if (ans < N)PutBack(ans);
    }

}











Compilation message

assistant.cpp: In function 'void Assist(unsigned char*, int, int, int)':
assistant.cpp:40:13: warning: unused variable 'req' [-Wunused-variable]
   40 |         int req = GetRequest();
      |             ^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 868 KB Output is correct
2 Incorrect 2 ms 872 KB Output isn't correct - not an optimal way
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 44 ms 2188 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 359 ms 12236 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 872 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 440 ms 15148 KB Output isn't correct - not an optimal way
2 Incorrect 442 ms 14924 KB Output isn't correct - not an optimal way
3 Incorrect 441 ms 15084 KB Output isn't correct - not an optimal way
4 Incorrect 443 ms 15048 KB Output isn't correct - not an optimal way
5 Incorrect 438 ms 15248 KB Output isn't correct - not an optimal way
6 Incorrect 437 ms 15048 KB Output isn't correct - not an optimal way
7 Incorrect 434 ms 14952 KB Output isn't correct - not an optimal way
8 Incorrect 436 ms 14736 KB Output isn't correct - not an optimal way
9 Incorrect 435 ms 15256 KB Output isn't correct - not an optimal way
10 Correct 443 ms 14864 KB Output is partially correct - 1800000 bits used