Submission #123345

# Submission time Handle Problem Language Result Execution time Memory
123345 2019-07-01T07:48:04 Z neki Mechanical Doll (IOI18_doll) C++14
0 / 100
1 ms 212 KB
#include "doll.h"
#include <bits/stdc++.h>
#define maxn 756000

#define loop(i, a, b) for(int i=a;i<b;i++)
#define cc(a) cout<< a << endl;
using namespace std;

vector<int> arr;
vector<int> X, Y;

int cnt=-1;

void ne(vector<int> sez){
    cc(sez.size());
    int js=-cnt-1;
    cnt--;
    X.push_back(0);Y.push_back(0);
    if(sez.size()==2){
        X[js]=sez[0];
        Y[js]=sez[1];
    }
    else{
        vector<int> l;vector<int> r;
        loop(i, 0, sez.size()){
            if(i%2==0) l.push_back(sez[i]);
            if(i%2==1) r.push_back(sez[i]);
        }
        X[js]=cnt;ne(l);
        Y[js]=cnt;ne(r);
    }
}

void create_circuit(int M, vector<int> A) {
    vector<int> C(M + 1);loop(i, 0, M+1) C[i]=-1;
    arr=A;
    int cr=1;for(;cr<arr.size()+1;cr<<=1);
    while(arr.size()!=cr) arr.push_back(-1);
    arr[arr.size()-1]=0;
    ne(arr);
    answer(C, X, Y);
}

Compilation message

doll.cpp: In function 'void ne(std::vector<int>)':
doll.cpp:5:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    5 | #define loop(i, a, b) for(int i=a;i<b;i++)
......
   25 |         loop(i, 0, sez.size()){
      |              ~~~~~~~~~~~~~~~~       
doll.cpp:25:9: note: in expansion of macro 'loop'
   25 |         loop(i, 0, sez.size()){
      |         ^~~~
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:37:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |     int cr=1;for(;cr<arr.size()+1;cr<<=1);
      |                   ~~^~~~~~~~~~~~~
doll.cpp:38:21: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   38 |     while(arr.size()!=cr) arr.push_back(-1);
      |           ~~~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -