Submission #99256

# Submission time Handle Problem Language Result Execution time Memory
99256 2019-03-02T03:09:38 Z duy_tran Carnival (CEOI14_carnival) C++14
0 / 100
31 ms 384 KB
#include<bits/stdc++.h>
using namespace std;

const int maxn=(int)200;
int n,chk[maxn],c;
vector<int> a;

int main()
{
    scanf("%d", &n);

    for(int i=1;i<=n;++i)
    {
        int cnt=0;
        a.clear();
        for(int j=1;j<=n;++j)
            if(!chk[j])a.push_back(j),++cnt;

        int l=0;int r=a.size()-1;
        int mid;

        printf("%d ",cnt);
        fflush(stdout);
        for(int j:a)
        {
            if(j==a.back())printf("%d\n",j);
            else printf("%d ",j);
            fflush(stdout);
        }
        scanf("%d", &c);

        if(c==1)
        {
            for(int j:a)chk[j]=c;
            break;
        }

        else
        {
            int l=0;int r=a.size()-1;
            int mid;

            while(l<=r)
            {
                mid=(l+r)/2;

                int nc;
                printf("%d ",mid);
                fflush(stdout);
                for(int j=0;j<mid;++j)
                {
                    if(j==mid-1)printf("%d\n",a[j]);
                    else printf("%d ",a[j]);
                    fflush(stdout);
                }

                scanf("%d", &nc);

                if(nc<c-1)l=mid+1;
                else r=mid-1;
            }

            chk[a[l]]=c;
        }
    }

    int en=0;
    printf("%d ",en);
    fflush(stdout);

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

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:19:13: warning: unused variable 'l' [-Wunused-variable]
         int l=0;int r=a.size()-1;
             ^
carnival.cpp:19:21: warning: unused variable 'r' [-Wunused-variable]
         int l=0;int r=a.size()-1;
                     ^
carnival.cpp:20:13: warning: unused variable 'mid' [-Wunused-variable]
         int mid;
             ^~~
carnival.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
carnival.cpp:30:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &c);
         ~~~~~^~~~~~~~~~
carnival.cpp:57:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
                 scanf("%d", &nc);
                 ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Execution timed out 20 ms 384 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 31 ms 384 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Execution timed out 28 ms 256 KB Time limit exceeded (wall clock)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 30 ms 384 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3 ms 256 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -