답안 #115517

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
115517 2019-06-08T03:18:38 Z onjo0127 자동 인형 (IOI18_doll) C++11
18 / 100
30 ms 2232 KB
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;

void create_circuit(int M, vector<int> A) {
    int N = A.size();
    vector<int> C(M + 1);
    C[0] = -1; C[1] = -1;
    int i;
    for(i=1; (1<<i)<=N; i++);
    vector<int> X(i), Y(i);
    int x = N;
    vector<int> S;
    while(x) {
        S.push_back(x%2);
        x /= 2;
    }
    reverse(S.begin(), S.end());
    for(int j=0; j<i; j++) X[j] = -1, Y[j] = -j-2;
    Y[i-1] = 0;
    for(int i=0; i<S.size(); i++) {
        if(S[i]) X[i] = 1;
    }
    answer(C, X, Y);
}

Compilation message

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:21:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     for(int i=0; i<S.size(); i++) {
      |                  ~^~~~~~~~~
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 204 KB wrong motion
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 17 ms 1332 KB Output is correct
3 Correct 27 ms 1220 KB Output is correct
4 Correct 26 ms 1852 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 17 ms 1332 KB Output is correct
3 Correct 27 ms 1220 KB Output is correct
4 Correct 26 ms 1852 KB Output is correct
5 Incorrect 30 ms 2232 KB wrong motion
6 Halted 0 ms 0 KB -