답안 #556835

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
556835 2022-05-04T03:07:37 Z hibiki 사육제 (CEOI14_carnival) C++11
100 / 100
21 ms 336 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)
        {
            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:30:22: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wformat=]
   30 |             printf("%d ",ask.size());
      |                     ~^   ~~~~~~~~~~
      |                      |           |
      |                      int         std::vector<int>::size_type {aka long unsigned int}
      |                     %ld
carnival.cpp:38:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::set<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |             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:37:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   37 |             scanf("%d",&ret);
      |             ~~~~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 208 KB Output is correct
2 Correct 9 ms 208 KB Output is correct
3 Correct 12 ms 292 KB Output is correct
4 Correct 13 ms 208 KB Output is correct
5 Correct 8 ms 208 KB Output is correct
6 Correct 9 ms 208 KB Output is correct
7 Correct 11 ms 300 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 208 KB Output is correct
2 Correct 8 ms 336 KB Output is correct
3 Correct 9 ms 208 KB Output is correct
4 Correct 13 ms 208 KB Output is correct
5 Correct 10 ms 300 KB Output is correct
6 Correct 10 ms 208 KB Output is correct
7 Correct 8 ms 296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 208 KB Output is correct
2 Correct 9 ms 208 KB Output is correct
3 Correct 13 ms 208 KB Output is correct
4 Correct 16 ms 280 KB Output is correct
5 Correct 14 ms 296 KB Output is correct
6 Correct 11 ms 208 KB Output is correct
7 Correct 12 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 208 KB Output is correct
2 Correct 14 ms 208 KB Output is correct
3 Correct 18 ms 284 KB Output is correct
4 Correct 21 ms 284 KB Output is correct
5 Correct 7 ms 300 KB Output is correct
6 Correct 11 ms 300 KB Output is correct
7 Correct 12 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 208 KB Output is correct
2 Correct 14 ms 208 KB Output is correct
3 Correct 14 ms 300 KB Output is correct
4 Correct 20 ms 208 KB Output is correct
5 Correct 12 ms 208 KB Output is correct
6 Correct 13 ms 284 KB Output is correct
7 Correct 16 ms 296 KB Output is correct