Submission #940770

# Submission time Handle Problem Language Result Execution time Memory
940770 2024-03-07T15:33:43 Z snpmrnhlol Mechanical Doll (IOI18_doll) C++17
9 / 100
173 ms 17980 KB
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
void create_circuit(int m, vector<int> a) {
    int n = a.size();
    int len = 0;
    int cnt = -2;
    while((1<<len) < n + 1)len++;
    vector <int> c(m + 1);
    vector <int> x((1<<len) - 1);
    vector <int> y((1<<len) - 1);
    vector <int> x2((1<<len) - 1);
    vector <int> y2((1<<len) - 1);
    vector <int> d((1<<len) - 1);
    vector <int> ok((1<<len) - 1);
    vector <int> mrk((1<<len) - 1);
    vector <int> ord;
    vector <int> ord2;
    vector <int> ord3;
    for(int i = 0;i < m + 1;i++){
        c[i] = -1;
    }
    auto dfs = [&](auto self,int node,int d) -> void {
        if(d == len - 1){
            x[-node - 1] = -1;
            y[-node - 1] = -1;
        }else{
            x[-node - 1] = cnt--;
            self(self,cnt + 1,d + 1);
            y[-node - 1] = cnt--;
            self(self,cnt + 1,d + 1);
        }
    };
    auto dfs2 = [&](auto self,int node,int d) -> void {
        if(d == len - 1){
            ord.push_back(node);
        }else{
            if(!mrk[node]){
                self(self,-x[node] - 1,d + 1);
            }else{
                self(self,-y[node] - 1,d + 1);
            }
            mrk[node]^=1;
        }
    };
    dfs(dfs,-1,0);
    for(int i = 0;i < (1<<len);i++){
        dfs2(dfs2,0,0);
        ord2.push_back(i);
    }
    sort(ord2.begin(),ord2.end(),[&](int a,int b){
         return ord[a] < ord[b];
    });
    for(int i = 0;i < n;i++){
        ord3.push_back(i);
    }
    sort(ord3.begin(),ord3.end(),[&](int a,int b){
         return ord2[a] < ord2[b];
    });
    for(int i = 0;i < n;i++){
        int id = ord[ord2[ord3[i]]];
        if(x[id] == -1){
            x[id] = a[i];
        }else{
            y[id] = a[i];
        }
    }
    y[ord[ord2[(1<<len) - 1]]] = 0;
    return answer(c,x,y);
}
/**
5 4
1 2 3 1
**/
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 344 KB Output is partially correct
2 Partially correct 143 ms 16736 KB Output is partially correct
3 Partially correct 152 ms 16356 KB Output is partially correct
4 Partially correct 158 ms 17724 KB Output is partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 344 KB Output is partially correct
2 Partially correct 143 ms 16736 KB Output is partially correct
3 Partially correct 152 ms 16356 KB Output is partially correct
4 Partially correct 158 ms 17724 KB Output is partially correct
5 Partially correct 173 ms 17980 KB Output is partially correct
6 Partially correct 163 ms 17704 KB Output is partially correct
7 Partially correct 164 ms 17728 KB Output is partially correct
8 Partially correct 168 ms 17792 KB Output is partially correct
9 Partially correct 147 ms 16400 KB Output is partially correct
10 Partially correct 161 ms 17648 KB Output is partially correct
11 Partially correct 170 ms 17744 KB Output is partially correct
12 Partially correct 150 ms 16372 KB Output is partially correct
13 Partially correct 150 ms 16832 KB Output is partially correct
14 Partially correct 152 ms 16460 KB Output is partially correct
15 Partially correct 147 ms 16452 KB Output is partially correct
16 Partially correct 3 ms 856 KB Output is partially correct
17 Incorrect 81 ms 9716 KB wrong motion
18 Halted 0 ms 0 KB -