Submission #782405

# Submission time Handle Problem Language Result Execution time Memory
782405 2023-07-13T23:17:58 Z vjudge1 Mechanical Doll (IOI18_doll) C++17
53 / 100
146 ms 28128 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]);
    }
    int tmp = X.size();
    ms(0,0);
    X[tmp] = CALCTREE(v[0], lev-1);
    Y[tmp] = CALCTREE(v[1],lev-1);
    return -tmp-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);
        if(adj[i].size()==1) x = 0;
        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 26 ms 15788 KB Output is correct
3 Correct 24 ms 15420 KB Output is correct
4 Correct 5 ms 11988 KB Output is correct
5 Correct 12 ms 13192 KB Output is correct
6 Correct 33 ms 17296 KB Output is correct
7 Correct 5 ms 11948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 11988 KB Output is correct
2 Correct 26 ms 15788 KB Output is correct
3 Correct 24 ms 15420 KB Output is correct
4 Correct 5 ms 11988 KB Output is correct
5 Correct 12 ms 13192 KB Output is correct
6 Correct 33 ms 17296 KB Output is correct
7 Correct 5 ms 11948 KB Output is correct
8 Correct 47 ms 18708 KB Output is correct
9 Correct 59 ms 19124 KB Output is correct
10 Correct 77 ms 22364 KB Output is correct
11 Correct 6 ms 12052 KB Output is correct
12 Correct 5 ms 12048 KB Output is correct
13 Correct 5 ms 11988 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 11988 KB Output is correct
2 Correct 26 ms 15788 KB Output is correct
3 Correct 24 ms 15420 KB Output is correct
4 Correct 5 ms 11988 KB Output is correct
5 Correct 12 ms 13192 KB Output is correct
6 Correct 33 ms 17296 KB Output is correct
7 Correct 5 ms 11948 KB Output is correct
8 Correct 47 ms 18708 KB Output is correct
9 Correct 59 ms 19124 KB Output is correct
10 Correct 77 ms 22364 KB Output is correct
11 Correct 6 ms 12052 KB Output is correct
12 Correct 5 ms 12048 KB Output is correct
13 Correct 5 ms 11988 KB Output is correct
14 Correct 90 ms 24168 KB Output is correct
15 Correct 55 ms 18472 KB Output is correct
16 Correct 74 ms 21272 KB Output is correct
17 Correct 5 ms 12048 KB Output is correct
18 Correct 6 ms 11988 KB Output is correct
19 Correct 6 ms 11924 KB Output is correct
20 Correct 79 ms 22768 KB Output is correct
21 Correct 5 ms 11988 KB Output is correct
22 Correct 5 ms 12044 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 12016 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 5 ms 11988 KB Output is partially correct
2 Correct 57 ms 18832 KB Output is correct
3 Partially correct 93 ms 23216 KB Output is partially correct
4 Partially correct 98 ms 23684 KB Output is partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 5 ms 11988 KB Output is partially correct
2 Correct 57 ms 18832 KB Output is correct
3 Partially correct 93 ms 23216 KB Output is partially correct
4 Partially correct 98 ms 23684 KB Output is partially correct
5 Partially correct 107 ms 25460 KB Output is partially correct
6 Partially correct 132 ms 26740 KB Output is partially correct
7 Partially correct 116 ms 26364 KB Output is partially correct
8 Partially correct 127 ms 27408 KB Output is partially correct
9 Partially correct 96 ms 22988 KB Output is partially correct
10 Partially correct 146 ms 26204 KB Output is partially correct
11 Partially correct 130 ms 28128 KB Output is partially correct
12 Partially correct 87 ms 21624 KB Output is partially correct
13 Partially correct 78 ms 20832 KB Output is partially correct
14 Partially correct 77 ms 20548 KB Output is partially correct
15 Partially correct 75 ms 20144 KB Output is partially correct
16 Partially correct 7 ms 12320 KB Output is partially correct
17 Partially correct 79 ms 19548 KB Output is partially correct
18 Partially correct 71 ms 20404 KB Output is partially correct
19 Partially correct 76 ms 20136 KB Output is partially correct
20 Partially correct 101 ms 23556 KB Output is partially correct
21 Partially correct 115 ms 26024 KB Output is partially correct
22 Partially correct 98 ms 22624 KB Output is partially correct