Submission #853781

# Submission time Handle Problem Language Result Execution time Memory
853781 2023-09-25T08:14:03 Z abcvuitunggio Mechanical Doll (IOI18_doll) C++17
18 / 100
25 ms 3692 KB
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
void create_circuit(int M, vector<int> A) {
    int N=A.size()-1;
    vector <int> C(M+1),X,Y,ve;
    C[0]=1;
    if (!N){
        C[1]=0;
        answer(C,X,Y);
        return;
    }
    C[1]=-1;
    ve.push_back(1);
    for (int i=0;(1<<i)<=N;i++){
        ve.push_back(1<<i);
        N-=(1<<i);
    }
    for (int i=0;i<20;i++)
        if ((N>>i)&1)
            ve.push_back(1<<i);
    sort(ve.begin(),ve.end());
    for (int i=1;i<ve.size();i++){
        int sum=0;
        Y.push_back(-i-1);
        for (int j=i-1;j>=0;j--){
            sum+=ve[j];
            if (sum==ve[i]){
                X.push_back((j?-j:1));
                break;
            }
        }
    }
    Y[Y.size()-1]=0;
    answer(C,X,Y);
}

Compilation message

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:23:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for (int i=1;i<ve.size();i++){
      |                  ~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 436 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 436 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 436 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 604 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 14 ms 2396 KB Output is correct
3 Correct 13 ms 2396 KB Output is correct
4 Correct 22 ms 3388 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 14 ms 2396 KB Output is correct
3 Correct 13 ms 2396 KB Output is correct
4 Correct 22 ms 3388 KB Output is correct
5 Incorrect 25 ms 3692 KB wrong motion
6 Halted 0 ms 0 KB -