Submission #99255

# Submission time Handle Problem Language Result Execution time Memory
99255 2019-03-02T03:06:52 Z duy_tran Carnival (CEOI14_carnival) C++14
0 / 100
30 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(i),++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[mid]]=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:31: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);
                 ~~~~~^~~~~~~~~~~
carnival.cpp:63:22: warning: 'mid' may be used uninitialized in this function [-Wmaybe-uninitialized]
             chk[a[mid]]=c;
                      ^
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 256 KB Same person came twice to the party.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 384 KB Same person came twice to the party.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 256 KB Same person came twice to the party.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 384 KB Same person came twice to the party.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 384 KB Same person came twice to the party.
2 Halted 0 ms 0 KB -