답안 #25911

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
25911 2017-06-25T05:45:53 Z 김현수(#1087) 사육제 (CEOI14_carnival) C++11
100 / 100
23 ms 2020 KB
#include<bits/stdc++.h>
using namespace std;
int n, a[305];
vector<int> h;

void Add (int I) {
	int S = 0, E = h.size();
	while(S<E) {
		int M = (S+E)/2, T;
		printf("%d ", M+2);
		for(int i=0;i<=M;i++) printf("%d ",h[i]);
		printf("%d ",I);
		fflush(stdout);
		scanf("%d",&T);
		T == M+2 ? S = M+1 : E = M;
	}
	if(S == h.size()) h.push_back(I);
	a[I] = S+1;
}

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) Add(i);
	printf("0 ");
	for(int i=1;i<=n;i++) printf("%d ",a[i]);
}

Compilation message

carnival.cpp: In function 'void Add(int)':
carnival.cpp:17:7: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if(S == h.size()) h.push_back(I);
       ^
carnival.cpp:14:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&T);
                 ^
carnival.cpp: In function 'int main()':
carnival.cpp:23:16: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
                ^
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 2020 KB Output is correct
2 Correct 3 ms 2020 KB Output is correct
3 Correct 6 ms 2020 KB Output is correct
4 Correct 9 ms 2020 KB Output is correct
5 Correct 0 ms 2020 KB Output is correct
6 Correct 0 ms 2020 KB Output is correct
7 Correct 6 ms 2020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2020 KB Output is correct
2 Correct 3 ms 2020 KB Output is correct
3 Correct 6 ms 2020 KB Output is correct
4 Correct 3 ms 2020 KB Output is correct
5 Correct 3 ms 2020 KB Output is correct
6 Correct 3 ms 2020 KB Output is correct
7 Correct 0 ms 2020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2020 KB Output is correct
2 Correct 3 ms 2020 KB Output is correct
3 Correct 3 ms 2020 KB Output is correct
4 Correct 3 ms 2020 KB Output is correct
5 Correct 0 ms 2020 KB Output is correct
6 Correct 6 ms 2020 KB Output is correct
7 Correct 6 ms 2020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2020 KB Output is correct
2 Correct 6 ms 2020 KB Output is correct
3 Correct 9 ms 2020 KB Output is correct
4 Correct 13 ms 2020 KB Output is correct
5 Correct 6 ms 2020 KB Output is correct
6 Correct 3 ms 2020 KB Output is correct
7 Correct 6 ms 2020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2020 KB Output is correct
2 Correct 0 ms 2020 KB Output is correct
3 Correct 6 ms 2020 KB Output is correct
4 Correct 23 ms 2020 KB Output is correct
5 Correct 0 ms 2020 KB Output is correct
6 Correct 6 ms 2020 KB Output is correct
7 Correct 9 ms 2020 KB Output is correct