Submission #782391

# Submission time Handle Problem Language Result Execution time Memory
782391 2023-07-13T22:59:06 Z vjudge1 Mechanical Doll (IOI18_doll) C++17
0 / 100
59 ms 21416 KB
#include "doll.h"
#include<bits/stdc++.h>
using namespace std;
vector<int> X, Y, C;
int ms(int a, int b) {
    X.push_back(a);
    Y.push_back(b);
    return -Y.size();
}
int CALCTREE(vector<int> x, int lev) {
    if(lev==0) return x[0];
    vector<int> v[2];
    for(int i = 0; i < x.size(); i++) {
        v[i%2].push_back(x[i]);
    }
    return ms(CALCTREE(v[0],lev-1), CALCTREE(v[1],lev-1));
}
vector<int> adj[500100];
void create_circuit(int M, std::vector<int> A) {
    C.resize(M+1);
    int n = A.size();
    adj[0].push_back(A[0]);
    A.push_back(0);
    for(int i = 0; i < n; i++)
        adj[A[i]].push_back(A[i+1]);
    for(int i = 0; i <= M; i++) {
        if(!adj[i].size()) continue;
        int x = 32-__builtin_clz((int)adj[i].size()-1);
        int targetsz=1<<x;
        vector<int> make;
        for(int j = adj[i].size(); j < targetsz; j++) {
            make.push_back(-(int)X.size()-1);
        }
        for(auto j:adj[i])
            make.push_back(j);
        C[i] = CALCTREE(make,x);
    }
    answer(C, X, Y);
    
}

Compilation message

doll.cpp: In function 'int CALCTREE(std::vector<int>, int)':
doll.cpp:13:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for(int i = 0; i < x.size(); i++) {
      |                    ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 11988 KB Output is correct
2 Correct 48 ms 18460 KB Output is correct
3 Correct 40 ms 18416 KB Output is correct
4 Correct 6 ms 12048 KB Output is correct
5 Correct 13 ms 13200 KB Output is correct
6 Correct 59 ms 21416 KB Output is correct
7 Incorrect 5 ms 11940 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 11988 KB Output is correct
2 Correct 48 ms 18460 KB Output is correct
3 Correct 40 ms 18416 KB Output is correct
4 Correct 6 ms 12048 KB Output is correct
5 Correct 13 ms 13200 KB Output is correct
6 Correct 59 ms 21416 KB Output is correct
7 Incorrect 5 ms 11940 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 11988 KB Output is correct
2 Correct 48 ms 18460 KB Output is correct
3 Correct 40 ms 18416 KB Output is correct
4 Correct 6 ms 12048 KB Output is correct
5 Correct 13 ms 13200 KB Output is correct
6 Correct 59 ms 21416 KB Output is correct
7 Incorrect 5 ms 11940 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 12000 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 12052 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 12052 KB wrong motion
2 Halted 0 ms 0 KB -