답안 #674269

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
674269 2022-12-23T15:28:08 Z groshi 사육제 (CEOI14_carnival) C++17
100 / 100
12 ms 208 KB
#include<iostream>

using namespace std;
int jaki[200];
int ost=2;
int bylo[200];
int rozne(int x,int y)
{
    for(int i=0;i<=150;i++)
        bylo[i]=0;
    int wynik=0;
    for(int i=x;i<=y;i++)
    {
        if(bylo[jaki[i]])
            continue;
        wynik++;
        bylo[jaki[i]]=1;
    }
    return wynik;
}
int32_t main()
{
    //ios_base::sync_with_stdio(0);
    //cin.tie(0);
    ///cout.tie(0);
    int n,odp;
    cin>>n;
    jaki[1]=1;
    for(int i=2;i<=n;i++)
    {
        int pocz=1,kon=i,sre,ostd;
        cout<<i<<" ";
        for(int j=1;j<=i;j++)
            cout<<j<<" ";
        cout<<"\n";
        cin>>odp;
        if(odp==ost)
        {
            jaki[i]=ost;
            ost++;
            continue;
        }
        while(pocz<kon)
        {
            sre=(pocz+kon)/2;
            cout<<sre-pocz+2<<" ";
            for(int j=pocz;j<=sre;j++)
                cout<<j<<" ";
            cout<<i<<"\n";
            cin>>odp;
            if(odp==rozne(pocz,sre))
                kon=sre;
            else pocz=sre+1;
        }
        jaki[i]=jaki[pocz];
    }
    cout<<"0 ";
    for(int i=1;i<=n;i++)
        cout<<jaki[i]<<" ";
    cout<<"\n";
	return 0;
}

Compilation message

carnival.cpp: In function 'int32_t main()':
carnival.cpp:31:30: warning: unused variable 'ostd' [-Wunused-variable]
   31 |         int pocz=1,kon=i,sre,ostd;
      |                              ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 208 KB Output is correct
2 Correct 5 ms 208 KB Output is correct
3 Correct 4 ms 208 KB Output is correct
4 Correct 2 ms 208 KB Output is correct
5 Correct 11 ms 208 KB Output is correct
6 Correct 10 ms 208 KB Output is correct
7 Correct 9 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 208 KB Output is correct
2 Correct 10 ms 208 KB Output is correct
3 Correct 4 ms 208 KB Output is correct
4 Correct 3 ms 208 KB Output is correct
5 Correct 11 ms 208 KB Output is correct
6 Correct 11 ms 208 KB Output is correct
7 Correct 10 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 208 KB Output is correct
2 Correct 11 ms 208 KB Output is correct
3 Correct 8 ms 208 KB Output is correct
4 Correct 2 ms 208 KB Output is correct
5 Correct 8 ms 208 KB Output is correct
6 Correct 8 ms 208 KB Output is correct
7 Correct 7 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 208 KB Output is correct
2 Correct 9 ms 208 KB Output is correct
3 Correct 8 ms 208 KB Output is correct
4 Correct 4 ms 208 KB Output is correct
5 Correct 6 ms 208 KB Output is correct
6 Correct 7 ms 208 KB Output is correct
7 Correct 9 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 208 KB Output is correct
2 Correct 11 ms 208 KB Output is correct
3 Correct 8 ms 208 KB Output is correct
4 Correct 4 ms 208 KB Output is correct
5 Correct 7 ms 208 KB Output is correct
6 Correct 3 ms 208 KB Output is correct
7 Correct 3 ms 208 KB Output is correct