답안 #596455

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
596455 2022-07-14T18:56:47 Z Summers 사육제 (CEOI14_carnival) C++14
0 / 100
0 ms 220 KB
#include<bits/stdc++.h>
#pragma GCC optimize ("O3")
#define endl '\n'
using namespace std;
long long a[10000], r[1000];
int main()
{
    //ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    long long i,j,n,le,ri,mid,num=1,ans;

    cin>>n;

    a[1]=1;r[1]=1;

    for(i=2;i<=n;i++)
    {
        cout<<num+1;
        for(j=1;j<=num;j++)cout<<" "<<a[j];
        cout<<" "<<i<<endl;
        cin>>ans;
        if(ans>num){num++;a[num]=i;r[i]=num;continue;}
        le=1; ri=num;
        while(le<=ri)
        {
            mid=(le+ri)/2;
            cout<<mid-le+1;
            for(j=le;j<mid;j++)cout<<" "<<a[j];
            cout<<" "<<i;
            cout<<endl;

            cin>>ans;
            if(ans==(mid-le+1))ri=mid-1;
            else le=mid+1;
        }
        r[i]=le;
    }
    cout<<0;
    for(i=1;i<=n;i++)cout<<" "<<r[i];cout<<endl;

    return 0;

}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:41:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   41 |     for(i=1;i<=n;i++)cout<<" "<<r[i];cout<<endl;
      |     ^~~
carnival.cpp:41:38: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   41 |     for(i=1;i<=n;i++)cout<<" "<<r[i];cout<<endl;
      |                                      ^~~~
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 0 ms 220 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 0 ms 208 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 0 ms 208 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 0 ms 208 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 0 ms 208 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -