답안 #333981

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
333981 2020-12-08T04:24:30 Z siddarthm 사육제 (CEOI14_carnival) C++11
100 / 100
10 ms 512 KB
#include <iostream>
#include <map>
using namespace std;

int main(){
    int n;
    cin >> n;
    int costume[n+1];
    map<int,int> matched;
    int counter = 0;
    for(int i=1; i<=n; i++)
    {
        cout << matched.size()+1;
        for(int j=1; j<=matched.size(); j++)
        {
            cout << " " << matched[j];
        }
        cout << " " << i << endl;
        int newcount;
        cin >> newcount;
        if(newcount>counter)
        {
            matched[newcount] = i;
            costume[i] = newcount;
            counter++;
            continue;
        }
        int a = 1;
        int b = matched.size();
        while(a!=b)
        {
            int mid = (a+b)/2;
            cout << mid-a+2;
            for(int j=a; j<=mid; j++)
            {
                cout << " " << matched[j];
            }
            cout << " " << i << endl;
            int newval;
            cin >> newval;
            if(newval==(mid-a+1))
                b = mid;
            else
                a = mid+1;
        }
        costume[i] = a;
    }
    cout << 0;
    for(int i=1; i<=n; i++)
    {
        cout << " " << costume[i];
    }
    cout << endl;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:14:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::map<int, int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |         for(int j=1; j<=matched.size(); j++)
      |                      ~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 364 KB Output is correct
2 Correct 8 ms 364 KB Output is correct
3 Correct 7 ms 364 KB Output is correct
4 Correct 5 ms 364 KB Output is correct
5 Correct 4 ms 364 KB Output is correct
6 Correct 2 ms 364 KB Output is correct
7 Correct 6 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 364 KB Output is correct
2 Correct 8 ms 364 KB Output is correct
3 Correct 4 ms 364 KB Output is correct
4 Correct 5 ms 364 KB Output is correct
5 Correct 8 ms 364 KB Output is correct
6 Correct 6 ms 364 KB Output is correct
7 Correct 6 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 364 KB Output is correct
2 Correct 6 ms 364 KB Output is correct
3 Correct 10 ms 364 KB Output is correct
4 Correct 5 ms 364 KB Output is correct
5 Correct 8 ms 364 KB Output is correct
6 Correct 7 ms 364 KB Output is correct
7 Correct 9 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 8 ms 364 KB Output is correct
3 Correct 7 ms 364 KB Output is correct
4 Correct 5 ms 364 KB Output is correct
5 Correct 8 ms 364 KB Output is correct
6 Correct 6 ms 364 KB Output is correct
7 Correct 8 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 364 KB Output is correct
2 Correct 7 ms 364 KB Output is correct
3 Correct 6 ms 364 KB Output is correct
4 Correct 6 ms 512 KB Output is correct
5 Correct 9 ms 364 KB Output is correct
6 Correct 5 ms 512 KB Output is correct
7 Correct 5 ms 364 KB Output is correct