Submission #170054

# Submission time Handle Problem Language Result Execution time Memory
170054 2019-12-23T20:20:13 Z rzbt Carnival (CEOI14_carnival) C++14
100 / 100
11 ms 376 KB
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define MAXN 155
typedef long long ll;


using namespace std;
int niz[MAXN];
int n,k;
vector<int> pozjed;

int bin(int l,int d,int sol,int koji){
    //printf("   usobin  %d %d   %d",k,d,koji);
    if(l>d)return sol;
    int mid=(l+d)/2;
    printf("%d ",d-mid+2);
    for(int i=mid;i<=d;i++){
        printf("%d ",pozjed[i]);
    }
    printf("%d ",koji);
    fflush(stdout);
    int razl;
    scanf("%d",&razl);
    if(razl==d-mid+1)return bin(mid+1,d,mid+1,koji);
    return bin(l,mid-1,sol,koji);
}

int main()
{
    scanf("%d", &n);
    niz[1]=1;
    k=1;
    pozjed.pb(1);
    for(int i=2;i<=n;i++){
        printf("%d ",i);
        for(int j=1;j<=i;j++)printf("%d ",j);
        fflush(stdout);
        int razl;
        scanf("%d", &razl);
        if(razl>k){
            k++;
            niz[i]=k;
            pozjed.pb(i);
            continue;
        }
        niz[i]=bin(0,k-1,-1,i);

    }
    printf("0 ");
    for(int i=1;i<=n;i++)printf("%d ",niz[i]);
    fflush(stdout);
    return 0;
    return 0;
}

Compilation message

carnival.cpp: In function 'int bin(int, int, int, int)':
carnival.cpp:27:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&razl);
     ~~~~~^~~~~~~~~~~~
carnival.cpp: In function 'int main()':
carnival.cpp:34:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
carnival.cpp:43:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &razl);
         ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 10 ms 248 KB Output is correct
2 Correct 9 ms 248 KB Output is correct
3 Correct 5 ms 296 KB Output is correct
4 Correct 4 ms 248 KB Output is correct
5 Correct 5 ms 248 KB Output is correct
6 Correct 6 ms 376 KB Output is correct
7 Correct 9 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 376 KB Output is correct
2 Correct 10 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 6 ms 376 KB Output is correct
5 Correct 10 ms 248 KB Output is correct
6 Correct 9 ms 376 KB Output is correct
7 Correct 6 ms 248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 376 KB Output is correct
2 Correct 9 ms 252 KB Output is correct
3 Correct 11 ms 248 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 6 ms 248 KB Output is correct
6 Correct 8 ms 248 KB Output is correct
7 Correct 10 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 376 KB Output is correct
2 Correct 10 ms 376 KB Output is correct
3 Correct 4 ms 248 KB Output is correct
4 Correct 4 ms 248 KB Output is correct
5 Correct 10 ms 252 KB Output is correct
6 Correct 9 ms 248 KB Output is correct
7 Correct 11 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 376 KB Output is correct
2 Correct 11 ms 248 KB Output is correct
3 Correct 9 ms 248 KB Output is correct
4 Correct 7 ms 248 KB Output is correct
5 Correct 5 ms 248 KB Output is correct
6 Correct 6 ms 248 KB Output is correct
7 Correct 4 ms 312 KB Output is correct