Submission #292539

# Submission time Handle Problem Language Result Execution time Memory
292539 2020-09-07T08:51:39 Z egekabas Mechanical Doll (IOI18_doll) C++14
53 / 100
226 ms 18372 KB
#include "doll.h"
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<int, int> pii;
typedef pair<ld, ld> pld;
vector<int> g[100009];
int x[400009];
int y[400009];
int n;
int curswitch = -1;
int create(vector<int> vec, int begin){
    if(vec.empty()) return 0;
    if(vec.size() == 1) return vec[0];
    int cur = curswitch;
    --curswitch;
    if(begin){
        reverse(all(vec));
        for(int i = 0; i < 30; ++i)
            if((1<<i) >= vec.size()){
                while(vec.size() < (1<<i))
                    vec.pb(cur);
                break;
            }
        reverse(all(vec));
    }
    vector<int> v1, v2;
    for(int i = 0; i < vec.size(); ++i){
        if(i%2 == 0)
            v1.pb(vec[i]);
        else
            v2.pb(vec[i]);
    }
    x[-(cur+1)] = create(v1, 0);
    y[-(cur+1)] = create(v2, 0);
    return cur;

}
void create_circuit(int M, std::vector<int> A) {
    n = A.size();
    for(int i = 1; i < n; ++i)
        g[A[i-1]].pb(A[i]);
    g[A[n-1]].pb(0);
    g[0].pb(A[0]);
    vector<int> C(M+1);
    for(int i = 0; i <= M; ++i){
        C[i] = create(g[i], 1);
    }
    int switchsize = -(curswitch+1);
    vector<int> X(switchsize), Y(switchsize);
    for(int i = 0; i < switchsize; ++i){
        X[i] = x[i];
        Y[i] = y[i];
    }
    
    answer(C, X, Y);
}

Compilation message

doll.cpp: In function 'int create(std::vector<int>, int)':
doll.cpp:29:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |             if((1<<i) >= vec.size()){
      |                ~~~~~~~^~~~~~~~~~~~~
doll.cpp:30:34: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   30 |                 while(vec.size() < (1<<i))
      |                       ~~~~~~~~~~~^~~~~~~~
doll.cpp:37:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |     for(int i = 0; i < vec.size(); ++i){
      |                    ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2636 KB Output is correct
2 Correct 34 ms 6364 KB Output is correct
3 Correct 30 ms 5956 KB Output is correct
4 Correct 2 ms 2636 KB Output is correct
5 Correct 15 ms 3752 KB Output is correct
6 Correct 52 ms 7616 KB Output is correct
7 Correct 3 ms 2636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2636 KB Output is correct
2 Correct 34 ms 6364 KB Output is correct
3 Correct 30 ms 5956 KB Output is correct
4 Correct 2 ms 2636 KB Output is correct
5 Correct 15 ms 3752 KB Output is correct
6 Correct 52 ms 7616 KB Output is correct
7 Correct 3 ms 2636 KB Output is correct
8 Correct 71 ms 8540 KB Output is correct
9 Correct 74 ms 8928 KB Output is correct
10 Correct 145 ms 11588 KB Output is correct
11 Correct 2 ms 2636 KB Output is correct
12 Correct 3 ms 2636 KB Output is correct
13 Correct 3 ms 2636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2636 KB Output is correct
2 Correct 34 ms 6364 KB Output is correct
3 Correct 30 ms 5956 KB Output is correct
4 Correct 2 ms 2636 KB Output is correct
5 Correct 15 ms 3752 KB Output is correct
6 Correct 52 ms 7616 KB Output is correct
7 Correct 3 ms 2636 KB Output is correct
8 Correct 71 ms 8540 KB Output is correct
9 Correct 74 ms 8928 KB Output is correct
10 Correct 145 ms 11588 KB Output is correct
11 Correct 2 ms 2636 KB Output is correct
12 Correct 3 ms 2636 KB Output is correct
13 Correct 3 ms 2636 KB Output is correct
14 Correct 149 ms 13292 KB Output is correct
15 Correct 85 ms 8132 KB Output is correct
16 Correct 117 ms 11008 KB Output is correct
17 Correct 2 ms 2636 KB Output is correct
18 Correct 2 ms 2636 KB Output is correct
19 Correct 3 ms 2636 KB Output is correct
20 Correct 119 ms 12264 KB Output is correct
21 Correct 3 ms 2636 KB Output is correct
22 Correct 2 ms 2636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 2636 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 3 ms 2636 KB Output is partially correct
2 Correct 79 ms 9392 KB Output is correct
3 Partially correct 145 ms 15524 KB Output is partially correct
4 Partially correct 152 ms 16028 KB Output is partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 3 ms 2636 KB Output is partially correct
2 Correct 79 ms 9392 KB Output is correct
3 Partially correct 145 ms 15524 KB Output is partially correct
4 Partially correct 152 ms 16028 KB Output is partially correct
5 Partially correct 178 ms 15728 KB Output is partially correct
6 Partially correct 191 ms 16872 KB Output is partially correct
7 Partially correct 192 ms 16496 KB Output is partially correct
8 Partially correct 198 ms 17692 KB Output is partially correct
9 Partially correct 147 ms 13400 KB Output is partially correct
10 Partially correct 226 ms 17920 KB Output is partially correct
11 Partially correct 215 ms 18372 KB Output is partially correct
12 Partially correct 137 ms 12996 KB Output is partially correct
13 Partially correct 121 ms 12080 KB Output is partially correct
14 Partially correct 116 ms 11716 KB Output is partially correct
15 Partially correct 107 ms 11148 KB Output is partially correct
16 Partially correct 5 ms 2892 KB Output is partially correct
17 Partially correct 119 ms 10820 KB Output is partially correct
18 Partially correct 108 ms 10844 KB Output is partially correct
19 Partially correct 116 ms 11460 KB Output is partially correct
20 Partially correct 150 ms 13936 KB Output is partially correct
21 Partially correct 198 ms 16332 KB Output is partially correct
22 Partially correct 155 ms 13340 KB Output is partially correct