답안 #625881

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
625881 2022-08-11T00:47:06 Z as111 사육제 (CEOI14_carnival) C++14
100 / 100
10 ms 300 KB
#include <iostream>
#include <vector>
using namespace std;
 
vector<int> pos;
int num[155], col[155], C;
 
int main()
{
	int N; scanf ("%d",&N);
	for (int i=1;i<N;i++){
		printf ("%d",N-i+1);
		for (int j=i;j<=N;j++) printf (" %d",j); puts(""); fflush(stdout);
		scanf ("%d",num+i);
	}
	num[N] = 1;
 
	for (int i=1;i<=N;i++) if (num[i] != num[i+1]){
		col[i] = ++C;
		pos.push_back(i);
	}
 
	for (int i=1;i<=N;i++) if (!col[i]){
		while (pos[0] < i) pos.erase(pos.begin());
		int l = 0, r = pos.size(), a = pos.size();
		while (l + 1 < r){
			int m = (l + r) / 2;
			int s = pos.size() - m + 1;
			printf ("%d",s);
			for (int i=m;i<pos.size();i++) printf (" %d",pos[i]);
			printf (" %d\n",i); fflush(stdout);
 
			int c; scanf ("%d",&c);
			if (c == s) r = m;
			else l = m;
		}
		col[i] = col[pos[l]];
	}
 
	printf ("0");
	for (int i=1;i<=N;i++) printf (" %d",col[i]); puts(""); fflush(stdout);
 
	return 0;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:13:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   13 |   for (int j=i;j<=N;j++) printf (" %d",j); puts(""); fflush(stdout);
      |   ^~~
carnival.cpp:13:44: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   13 |   for (int j=i;j<=N;j++) printf (" %d",j); puts(""); fflush(stdout);
      |                                            ^~~~
carnival.cpp:30:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |    for (int i=m;i<pos.size();i++) printf (" %d",pos[i]);
      |                 ~^~~~~~~~~~~
carnival.cpp:25:30: warning: unused variable 'a' [-Wunused-variable]
   25 |   int l = 0, r = pos.size(), a = pos.size();
      |                              ^
carnival.cpp:41:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   41 |  for (int i=1;i<=N;i++) printf (" %d",col[i]); puts(""); fflush(stdout);
      |  ^~~
carnival.cpp:41:48: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   41 |  for (int i=1;i<=N;i++) printf (" %d",col[i]); puts(""); fflush(stdout);
      |                                                ^~~~
carnival.cpp:10:15: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |  int N; scanf ("%d",&N);
      |         ~~~~~~^~~~~~~~~
carnival.cpp:14:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |   scanf ("%d",num+i);
      |   ~~~~~~^~~~~~~~~~~~
carnival.cpp:33:17: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |    int c; scanf ("%d",&c);
      |           ~~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 208 KB Output is correct
2 Correct 8 ms 208 KB Output is correct
3 Correct 4 ms 208 KB Output is correct
4 Correct 3 ms 300 KB Output is correct
5 Correct 4 ms 208 KB Output is correct
6 Correct 3 ms 208 KB Output is correct
7 Correct 9 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 208 KB Output is correct
2 Correct 8 ms 208 KB Output is correct
3 Correct 5 ms 208 KB Output is correct
4 Correct 4 ms 208 KB Output is correct
5 Correct 7 ms 208 KB Output is correct
6 Correct 7 ms 208 KB Output is correct
7 Correct 7 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 208 KB Output is correct
2 Correct 8 ms 208 KB Output is correct
3 Correct 9 ms 208 KB Output is correct
4 Correct 4 ms 208 KB Output is correct
5 Correct 10 ms 208 KB Output is correct
6 Correct 8 ms 208 KB Output is correct
7 Correct 7 ms 292 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 208 KB Output is correct
2 Correct 7 ms 208 KB Output is correct
3 Correct 4 ms 208 KB Output is correct
4 Correct 3 ms 208 KB Output is correct
5 Correct 6 ms 208 KB Output is correct
6 Correct 6 ms 208 KB Output is correct
7 Correct 7 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 208 KB Output is correct
2 Correct 4 ms 208 KB Output is correct
3 Correct 8 ms 208 KB Output is correct
4 Correct 7 ms 208 KB Output is correct
5 Correct 5 ms 208 KB Output is correct
6 Correct 3 ms 208 KB Output is correct
7 Correct 3 ms 212 KB Output is correct