Submission #556833

# Submission time Handle Problem Language Result Execution time Memory
556833 2022-05-04T03:06:22 Z hibiki Carnival (CEOI14_carnival) C++11
0 / 100
1 ms 288 KB
#include<bits/stdc++.h>
using namespace std;

#define PB push_back

int n,ty[160],cur_ty=1;

int main()
{
    ty[1]=cur_ty++;

    scanf("%d",&n);

    for(int i=2;i<=n;i++)
    {
        int l=1,r=i-1,nw_ty=-1;
        while(l<=r)
        {
            printf("%d %d\n",l,r);
            int mid=(l+r)>>1;
            set<int> s;
            vector<int> ask;

            for(int j=mid;j<i;j++)
            {
                s.insert(ty[j]);
                ask.PB(j);
            }
            ask.PB(i);

            printf("%d ",ask.size());
            for(auto val:ask)
                printf("%d ",val);
            printf("\n");
            fflush(stdout);

            int ret;
            scanf("%d",&ret);
            if(ret>s.size())
                r=mid-1;
            else
                nw_ty=ty[mid],l=mid+1;
        }
        if(nw_ty==-1)
            ty[i]=cur_ty++;
        else
            ty[i]=nw_ty;
    }

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

    return 0;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:31:22: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wformat=]
   31 |             printf("%d ",ask.size());
      |                     ~^   ~~~~~~~~~~
      |                      |           |
      |                      int         std::vector<int>::size_type {aka long unsigned int}
      |                     %ld
carnival.cpp:39:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::set<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |             if(ret>s.size())
      |                ~~~^~~~~~~~~
carnival.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
carnival.cpp:38:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   38 |             scanf("%d",&ret);
      |             ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 288 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -