답안 #172696

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
172696 2020-01-02T12:13:31 Z nafis_shifat 사육제 (CEOI14_carnival) C++14
100 / 100
12 ms 424 KB
#include<bits/stdc++.h>
#define pii pair<int,int>
#define ll long long
using namespace std;
const int mxn=160;
int main()
{
	int n;
	cin>>n;

	cout<<n<<" ";
	for(int i=1;i<=n;i++)cout<<i<<" ";
	cout<<endl;
    int lst;
    cin>>lst;

    vector<int> baps;
    baps.push_back(1);
    
    int dn[mxn]={};
    dn[1]=1;

    for(int i=n-1;i>0;i--)
    {
    	cout<<i<<" ";
    	for(int j=1;j<=i;j++)cout<<j<<" ";
    	cout<<endl;
        int t;
        cin>>t;

        if(t!=lst)
        {
        
        	baps.push_back(i+1);
        	dn[i+1]=1;

        }
        lst=t;
    }
    
   
    vector<int> p[mxn];

    for(int i=1;i<=n;i++)
    {
    	if(dn[i])continue;
    	
    	int lo=0;
    	int hi=baps.size()-1;
    	
    	int r;
    	while(1)
    	{
    		if(hi==lo)
    		{
    			r=hi;
    			break;
			}
    		int m=lo+hi>>1;
    		int t=m-lo+2;
    		cout<<t<<" "<<i<<" ";
    		for(int i=lo;i<=m;i++)
    		{
    			cout<<baps[i]<<" ";
				    			    			
			}
			
			cout<<endl;
			int x;
			cin>>x;
			if(x!=t)
			{
				hi=m;
			}
			else lo=m+1;	
    		
		}
		
		p[baps[r]].push_back(i);
		dn[i]=1;
    	
    }

    int res[mxn];



    for(int i=0;i<baps.size();i++)
    {
    	res[baps[i]]=i+1;
    	for(int j=0;j<p[baps[i]].size();j++)
    	{
    		res[p[baps[i]][j]]=i+1;
    	}
    }
    cout<<"0 ";
    for(int i=1;i<=n;i++)cout<<res[i]<<" ";
    cout<<endl;

	return 0;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:59:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
       int m=lo+hi>>1;
             ~~^~~
carnival.cpp:88:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<baps.size();i++)
                 ~^~~~~~~~~~~~
carnival.cpp:91:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
      for(int j=0;j<p[baps[i]].size();j++)
                  ~^~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 376 KB Output is correct
2 Correct 10 ms 376 KB Output is correct
3 Correct 8 ms 312 KB Output is correct
4 Correct 5 ms 296 KB Output is correct
5 Correct 7 ms 376 KB Output is correct
6 Correct 4 ms 400 KB Output is correct
7 Correct 10 ms 424 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 10 ms 380 KB Output is correct
3 Correct 6 ms 248 KB Output is correct
4 Correct 6 ms 248 KB Output is correct
5 Correct 10 ms 248 KB Output is correct
6 Correct 10 ms 376 KB Output is correct
7 Correct 11 ms 248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 248 KB Output is correct
2 Correct 10 ms 376 KB Output is correct
3 Correct 11 ms 248 KB Output is correct
4 Correct 4 ms 312 KB Output is correct
5 Correct 6 ms 376 KB Output is correct
6 Correct 12 ms 248 KB Output is correct
7 Correct 11 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 248 KB Output is correct
2 Correct 9 ms 248 KB Output is correct
3 Correct 7 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 7 ms 376 KB Output is correct
6 Correct 6 ms 248 KB Output is correct
7 Correct 12 ms 316 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 248 KB Output is correct
2 Correct 11 ms 376 KB Output is correct
3 Correct 10 ms 248 KB Output is correct
4 Correct 6 ms 376 KB Output is correct
5 Correct 10 ms 248 KB Output is correct
6 Correct 6 ms 248 KB Output is correct
7 Correct 4 ms 248 KB Output is correct