답안 #95663

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
95663 2019-02-02T07:21:24 Z shenxy 자동 인형 (IOI18_doll) C++11
0 / 100
27 ms 2212 KB
#include <algorithm>
#include "doll.h"
#include <vector>
using namespace std;
int num_bits_in(int N) {
	int ans = 0;
	while (N != 0) {
		ans += 1;
		N = N >> 1;
    }
	return ans;
}
void create_circuit(int M, vector<int> A) {
	if (M == 1) {
		int evilnum = A.size() - 1;
		vector<int> C(2);
		C[0] = 1;
		C[1] = -1;
		vector<int> X(num_bits_in(A.size() - 1), 1), Y(num_bits_in(A.size() - 1), 1);
		for (int i = 0; i < X.size(); i++) {
			if (evilnum & (1 << i)) Y[i] = 0 - (i + 1);
			else X[i] = 0 - (i + 1);
        }
		answer(C, X, Y);
		return;
    }
	int N = A.size();
	vector<int> exits(M + 1, 0);
	int ptr = 0;
	for (int i = 0; i < N; i++) {
		exits[ptr] = A[i];
		ptr = A[i];
	}
	answer(exits, {}, {});
}

Compilation message

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:20:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |   for (int i = 0; i < X.size(); i++) {
      |                   ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 21 ms 1952 KB Output is correct
3 Correct 21 ms 1484 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 11 ms 1356 KB Output is correct
6 Correct 27 ms 2212 KB Output is correct
7 Incorrect 1 ms 204 KB wrong serial number
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 21 ms 1952 KB Output is correct
3 Correct 21 ms 1484 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 11 ms 1356 KB Output is correct
6 Correct 27 ms 2212 KB Output is correct
7 Incorrect 1 ms 204 KB wrong serial number
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 21 ms 1952 KB Output is correct
3 Correct 21 ms 1484 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 11 ms 1356 KB Output is correct
6 Correct 27 ms 2212 KB Output is correct
7 Incorrect 1 ms 204 KB wrong serial number
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB wrong motion
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB wrong motion
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB wrong motion
2 Halted 0 ms 0 KB -