답안 #333597

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
333597 2020-12-07T06:59:50 Z siddarthm 사육제 (CEOI14_carnival) C++11
0 / 100
7 ms 364 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))
                a = mid+1;
            else
                b = mid;
        }
        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 Incorrect 7 ms 364 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 364 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 6 ms 364 KB Incorrect
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 364 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 364 KB Incorrect
2 Halted 0 ms 0 KB -