답안 #172375

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
172375 2020-01-01T12:24:54 Z bharat2002 사육제 (CEOI14_carnival) C++14
100 / 100
41 ms 640 KB
/*input

*/
#include<bits/stdc++.h>
using namespace std;
const int N=151;
const int mod=1e9 + 7;
#define int long long
const int inf=1e18;
#define pii pair<int, int>
#define f first
#define s second 
#define mp make_pair
#define FOR(i, n) for(int i=1;i<=n;i++)
#define TRACE(x) cerr << #x << " = " << x << endl 
//Trace prints the name of the variable and the value.
bool inc[N];int col[N];
int graph[N][N];int n;int RL;
bool p(int guy, int x)
{
	int num=1 + RL-x+1;
	cout<<num-1<<" ";
	for(int i=x;i<=RL;i++) cout<<i<<" ";cout<<endl;
	int ans, temp;cin>>temp;
	cout<<num<<" "<<guy<<" ";
	for(int i=x;i<=RL;i++) cout<<i<<" ";cout<<endl;
	cin>>ans;
	return ans==temp;
}
vector< set<int> > vals;
signed main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++) graph[i][j]=0;inc[i]=0;
		col[i]=-1;
	}
	set<int> cur;
	for(int i=1;i<=n;i++)
	{
		if(inc[i]) continue;
		int l=i+1;inc[i]=1;cur.clear();cur.insert(i);
		int r=n;RL=n;
		while(r>i)
		{
			l=i+1;
			while(l<r)
			{
				int mid=(l+r+1)/2;
				if(p(i, mid)) l=mid;
				else r=mid-1;
			}
			if(!p(i, r)) break;
			cur.insert(r);inc[r]=1;r--;RL=r;
		}
		vals.push_back(cur);
	}
	int cv=1;
	for(auto i:vals)
	{
		for(auto j:i) col[j]=cv;
		cv++;
	}
	cout<<0<<" ";
	for(int i=1;i<=n;i++) cout<<col[i]<<" ";
	cout<<endl;
}

Compilation message

carnival.cpp: In function 'bool p(long long int, long long int)':
carnival.cpp:23:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
  for(int i=x;i<=RL;i++) cout<<i<<" ";cout<<endl;
  ^~~
carnival.cpp:23:38: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  for(int i=x;i<=RL;i++) cout<<i<<" ";cout<<endl;
                                      ^~~~
carnival.cpp:26:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
  for(int i=x;i<=RL;i++) cout<<i<<" ";cout<<endl;
  ^~~
carnival.cpp:26:38: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  for(int i=x;i<=RL;i++) cout<<i<<" ";cout<<endl;
                                      ^~~~
carnival.cpp: In function 'int main()':
carnival.cpp:37:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   for(int j=1;j<=n;j++) graph[i][j]=0;inc[i]=0;
   ^~~
carnival.cpp:37:39: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   for(int j=1;j<=n;j++) graph[i][j]=0;inc[i]=0;
                                       ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 508 KB Output is correct
2 Correct 24 ms 380 KB Output is correct
3 Correct 23 ms 516 KB Output is correct
4 Correct 30 ms 508 KB Output is correct
5 Correct 25 ms 504 KB Output is correct
6 Correct 22 ms 504 KB Output is correct
7 Correct 25 ms 552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 504 KB Output is correct
2 Correct 21 ms 508 KB Output is correct
3 Correct 21 ms 468 KB Output is correct
4 Correct 31 ms 504 KB Output is correct
5 Correct 25 ms 504 KB Output is correct
6 Correct 26 ms 504 KB Output is correct
7 Correct 20 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 496 KB Output is correct
2 Correct 25 ms 504 KB Output is correct
3 Correct 27 ms 504 KB Output is correct
4 Correct 26 ms 604 KB Output is correct
5 Correct 13 ms 508 KB Output is correct
6 Correct 14 ms 632 KB Output is correct
7 Correct 23 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 552 KB Output is correct
2 Correct 24 ms 504 KB Output is correct
3 Correct 30 ms 504 KB Output is correct
4 Correct 31 ms 504 KB Output is correct
5 Correct 21 ms 512 KB Output is correct
6 Correct 29 ms 504 KB Output is correct
7 Correct 28 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 516 KB Output is correct
2 Correct 16 ms 552 KB Output is correct
3 Correct 28 ms 524 KB Output is correct
4 Correct 41 ms 640 KB Output is correct
5 Correct 36 ms 504 KB Output is correct
6 Correct 22 ms 632 KB Output is correct
7 Correct 20 ms 632 KB Output is correct