답안 #240933

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
240933 2020-06-21T14:15:00 Z Ruxandra985 자동 인형 (IOI18_doll) C++14
37 / 100
163 ms 26020 KB
#include <bits/stdc++.h>
#include "doll.h"
using namespace std;

void create_circuit(int m, vector<int> a) {
    int n = a.size() , i , l , aux , conf;
    vector <int> c;
    vector <int> x , y , w[400010];

    c.push_back(-1);

    for (i = 1 ; i <= m ; i++)
        c.push_back(-1);

    /// trb sa vezi cate noduri nu iti sunt necesare

    l = 0;
    while ((1 << l) <= n){
        l++;
    }


    for (i = 1 ; i <= (1 << l) - 1 ; i++){

        if (2 * i <= (1 << l) - 1){

            w[i].push_back(2 * i);
            w[i].push_back(2 * i + 1);

        }

    }

    for (i = 1 ; i <= (1 << l) - 1 ; i++){

        if (2 * i > (1 << l) - 1){

            aux = 2 * i;
            conf = 0;

            while (aux){
                conf = conf * 2 + (aux % 2);
                aux /= 2;
            }

            conf /= 2;

            if (conf < a.size())
                w[i].push_back(-a[conf]);
            else if (conf == (1 << l) - 1){
                w[i].push_back(0);
            }
            else w[i].push_back(1);

            /// -----------------------------------

            aux = 2 * i + 1;
            conf = 0;

            while (aux){
                conf = conf * 2 + (aux % 2);
                aux /= 2;
            }

            conf /= 2;

            if (conf < a.size())
                w[i].push_back(-a[conf]);
            else if (conf == (1 << l) - 1){
                w[i].push_back(0);
            }
            else w[i].push_back(1);


        }

    }


    x.resize((1 << l) - 1 , 0);
    y.resize((1 << l) - 1 , 0);



    for (i = 1 ; i <= (1 << l) - 1 ; i++){

        x[i - 1] = -w[i][0];
        y[i - 1] = -w[i][1];

    }

    answer (c , x , y);

}

Compilation message

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:48:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |             if (conf < a.size())
      |                 ~~~~~^~~~~~~~~~
doll.cpp:67:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   67 |             if (conf < a.size())
      |                 ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 9676 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 9676 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 9676 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 9676 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 9 ms 9684 KB Output is partially correct
2 Partially correct 126 ms 24992 KB Output is partially correct
3 Partially correct 112 ms 25052 KB Output is partially correct
4 Partially correct 163 ms 25516 KB Output is partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 9 ms 9684 KB Output is partially correct
2 Partially correct 126 ms 24992 KB Output is partially correct
3 Partially correct 112 ms 25052 KB Output is partially correct
4 Partially correct 163 ms 25516 KB Output is partially correct
5 Partially correct 130 ms 26020 KB Output is partially correct
6 Partially correct 131 ms 25788 KB Output is partially correct
7 Partially correct 133 ms 25924 KB Output is partially correct
8 Partially correct 134 ms 25796 KB Output is partially correct
9 Partially correct 114 ms 25000 KB Output is partially correct
10 Partially correct 129 ms 25656 KB Output is partially correct
11 Partially correct 136 ms 25532 KB Output is partially correct
12 Partially correct 117 ms 25092 KB Output is partially correct
13 Partially correct 118 ms 25256 KB Output is partially correct
14 Partially correct 115 ms 25296 KB Output is partially correct
15 Partially correct 129 ms 25284 KB Output is partially correct
16 Partially correct 11 ms 10216 KB Output is partially correct
17 Correct 76 ms 17860 KB Output is correct
18 Partially correct 133 ms 25036 KB Output is partially correct
19 Partially correct 117 ms 25100 KB Output is partially correct
20 Partially correct 121 ms 25668 KB Output is partially correct
21 Partially correct 123 ms 25528 KB Output is partially correct
22 Partially correct 132 ms 25572 KB Output is partially correct