Submission #123341

# Submission time Handle Problem Language Result Execution time Memory
123341 2019-07-01T07:38:27 Z neki Mechanical Doll (IOI18_doll) C++14
0 / 100
1 ms 204 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){
    int js=-cnt-1;
    cnt--;
    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.push_back(0);
    
    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++)
......
   23 |         loop(i, 0, sez.size()){
      |              ~~~~~~~~~~~~~~~~       
doll.cpp:23:9: note: in expansion of macro 'loop'
   23 |         loop(i, 0, sez.size()){
      |         ^~~~
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:35:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |     int cr=1;for(;cr<arr.size()+1;cr<<=1);
      |                   ~~^~~~~~~~~~~~~
doll.cpp:36:21: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |     while(arr.size()!=cr) arr.push_back(-1);
      |           ~~~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB wrong serial number
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB wrong serial number
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB wrong serial number
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB wrong serial number
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB wrong serial number
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB wrong serial number
2 Halted 0 ms 0 KB -