Submission #1060228

# Submission time Handle Problem Language Result Execution time Memory
1060228 2024-08-15T11:42:24 Z TlenekWodoru Mechanical Doll (IOI18_doll) C++14
100 / 100
53 ms 13808 KB
#include<bits/stdc++.h>
#include "doll.h"
using namespace std;
vector<pair<int,int>>U;
int Graf[2100009][2];
int h=1;
void F(int n)
{
    if(n==2)
    {
        U.push_back({1,0});
        U.push_back({1,1});
        return;
    }
    F((n+1)/2);
    vector<pair<int,int>>A,B;
    if(n%2==0)
    {
        for(auto[v,u] : U)
        {
            h++;
            Graf[v][u]=h;
            A.push_back({h,0});
            B.push_back({h,1});
        }
    }
    else
    {
        bool CzyPierwszy=1;
        for(auto[v,u] : U)
        {
            h++;
            Graf[v][u]=h;
            if(CzyPierwszy)
            {
                CzyPierwszy=0;
                Graf[h][1]=1;
                A.push_back({h,0});
                B.push_back({-1,-1});
            }
            else
            {
                A.push_back({h,0});
                B.push_back({h,1});
            }
        }
    }
    U.clear();
    for(auto xd : A)
    {
        U.push_back(xd);
    }
    for(auto xd : B)
    {
        if(xd.first==-1){continue;}
        U.push_back(xd);
    }
}
void create_circuit(int M, vector<int>A)
{
    A.push_back(0);
    F(A.size());
    vector<int>C(M+1,-1);
    vector<int>X(h),Y(h);
    for(int i=1;i<=h;i++)
    {
        X[i-1]=-Graf[i][0];
        Y[i-1]=-Graf[i][1];
    }
    for(int i=0;i<(int)U.size();i++)
    {
        if(U[i].second==0)
        {
            X[U[i].first-1]=A[i];
        }
        else
        {
            Y[U[i].first-1]=A[i];
        }
    }
    answer(C, X, Y);
}

Compilation message

doll.cpp: In function 'void F(int)':
doll.cpp:19:17: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   19 |         for(auto[v,u] : U)
      |                 ^
doll.cpp:30:17: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   30 |         for(auto[v,u] : U)
      |                 ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 20 ms 7292 KB Output is correct
3 Correct 17 ms 6788 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 6 ms 1628 KB Output is correct
6 Correct 27 ms 8940 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 20 ms 7292 KB Output is correct
3 Correct 17 ms 6788 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 6 ms 1628 KB Output is correct
6 Correct 27 ms 8940 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 31 ms 9824 KB Output is correct
9 Correct 32 ms 10340 KB Output is correct
10 Correct 51 ms 13808 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 20 ms 7292 KB Output is correct
3 Correct 17 ms 6788 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 6 ms 1628 KB Output is correct
6 Correct 27 ms 8940 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 31 ms 9824 KB Output is correct
9 Correct 32 ms 10340 KB Output is correct
10 Correct 51 ms 13808 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 42 ms 13368 KB Output is correct
15 Correct 35 ms 9316 KB Output is correct
16 Correct 42 ms 12936 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 43 ms 13572 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 28 ms 8408 KB Output is correct
3 Correct 26 ms 8300 KB Output is correct
4 Correct 37 ms 11576 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 28 ms 8408 KB Output is correct
3 Correct 26 ms 8300 KB Output is correct
4 Correct 37 ms 11576 KB Output is correct
5 Correct 43 ms 12860 KB Output is correct
6 Correct 41 ms 12508 KB Output is correct
7 Correct 53 ms 12604 KB Output is correct
8 Correct 39 ms 12352 KB Output is correct
9 Correct 25 ms 8296 KB Output is correct
10 Correct 46 ms 12088 KB Output is correct
11 Correct 38 ms 11836 KB Output is correct
12 Correct 31 ms 8548 KB Output is correct
13 Correct 27 ms 9144 KB Output is correct
14 Correct 28 ms 9068 KB Output is correct
15 Correct 31 ms 9552 KB Output is correct
16 Correct 1 ms 604 KB Output is correct
17 Correct 34 ms 8620 KB Output is correct
18 Correct 26 ms 8552 KB Output is correct
19 Correct 27 ms 8552 KB Output is correct
20 Correct 40 ms 12088 KB Output is correct
21 Correct 52 ms 11832 KB Output is correct
22 Correct 40 ms 11832 KB Output is correct