답안 #473734

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
473734 2021-09-16T03:11:22 Z zorz 사육제 (CEOI14_carnival) C++14
100 / 100
13 ms 320 KB
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define pb push_back
#define MOD 1000000007
#define int LL
#define vi vector<long long>
#define pi pair<long long, long long>
int sze[155], ans[155];
vi unq; 
main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n;
    cin >> n;
    ans[1] = 1;
    unq.pb(1); 
    sze[1] = 1;
    int input; 
    for (int i = 2; i <= n; ++i)
    {
        cout << i << " ";   
        for (int j = 1; j <= i; ++j) cout << j << " ";
        cout << endl;
        cin >> input; 
        sze[i] = input; 
        if (sze[i] == sze[i - 1]) // repeat
        {
            int l = 0, r = unq.size(), mid;
            while (l != r)
            {
                mid = (l + r) / 2;
                vi query; 
                for (int j = l; j <= mid; ++j)
                    query.pb(unq[j]); 
                query.pb(i); 
                cout << query.size() << " ";
                for (auto i : query) cout << i << " ";
                cout << endl;
                cin >> input; 
                if (input == query.size()) // no repeat
                    l = mid + 1;
                else 
                    r = mid; 
            }
            ans[i] = ans[unq[l]]; 
        }
        else 
        {
            unq.pb(i); 
            ans[i] = unq.size(); 
        }
    }
    cout << 0 << " ";
    for (int i = 1; i <= n; ++i) cout << ans[i] << " ";
    cout << endl;
    return 0;
}

Compilation message

carnival.cpp:11:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   11 | main()
      | ^~~~
carnival.cpp: In function 'int main()':
carnival.cpp:41:27: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |                 if (input == query.size()) // no repeat
      |                     ~~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 200 KB Output is correct
2 Correct 9 ms 200 KB Output is correct
3 Correct 6 ms 308 KB Output is correct
4 Correct 4 ms 200 KB Output is correct
5 Correct 6 ms 200 KB Output is correct
6 Correct 8 ms 200 KB Output is correct
7 Correct 8 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 200 KB Output is correct
2 Correct 11 ms 200 KB Output is correct
3 Correct 5 ms 312 KB Output is correct
4 Correct 3 ms 200 KB Output is correct
5 Correct 9 ms 200 KB Output is correct
6 Correct 6 ms 200 KB Output is correct
7 Correct 13 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 200 KB Output is correct
2 Correct 9 ms 200 KB Output is correct
3 Correct 12 ms 200 KB Output is correct
4 Correct 3 ms 200 KB Output is correct
5 Correct 7 ms 200 KB Output is correct
6 Correct 10 ms 200 KB Output is correct
7 Correct 9 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 200 KB Output is correct
2 Correct 8 ms 200 KB Output is correct
3 Correct 6 ms 200 KB Output is correct
4 Correct 5 ms 200 KB Output is correct
5 Correct 10 ms 200 KB Output is correct
6 Correct 6 ms 316 KB Output is correct
7 Correct 5 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 200 KB Output is correct
2 Correct 9 ms 200 KB Output is correct
3 Correct 5 ms 312 KB Output is correct
4 Correct 8 ms 200 KB Output is correct
5 Correct 9 ms 320 KB Output is correct
6 Correct 7 ms 312 KB Output is correct
7 Correct 4 ms 200 KB Output is correct