답안 #746084

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
746084 2023-05-21T11:35:25 Z Rafi22 자동 인형 (IOI18_doll) C++14
84 / 100
116 ms 83412 KB
#include <bits/stdc++.h>
#include "doll.h"
 
using namespace std;
 
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define ll long long
ll mod=1000000007;
int inf=1000000007;
ll infl=1000000000000000007;
 
const int N=400007;
 
int it,n;
 
int x[N+20];
int y[N+20];
bool state[N+20];
bool kon[N+20];
 
void build(int v,int l,int r)
{
    if(l+1==r)
    {
        kon[v]=1;
        if(n==l) x[v]=-1;
        return ;
    }
    it++;
    y[v]=-it;
    build(it,l,(l+r)/2);
    if(n>(l+r)/2)
    {
        it++;
        x[v]=-it;
        build(it,(l+r)/2+1,r);
    }
    else x[v]=-1;
}
 
void push(int v,int k)
{
    state[v]^=1;
    if(state[v])
    {
        if(kon[v])
        {
            if(x[v]==-1) push(1,k);
            else x[v]=k;
        }
        else push(-x[v],k);
    }
    else
    {
        if(kon[v])
        {
            if(y[v]==-1) push(1,k);
            else y[v]=k;
        }
        else push(-y[v],k);
    }
}
 
/*void answer(vector<int>c,vector<int>X,vector<int>Y)
{
    for(auto a:c) cout<<a<<" ";
    cout<<endl;
    for(auto a:X) cout<<a<<" ";
    cout<<endl;
    for(auto a:Y) cout<<a<<" ";
    cout<<endl;
}*/
 
void create_circuit(int m,vector<int>a)
{
    vector<int>c(m+1);
    n=sz(a);
    c[0]=a[0];
    for(int i=1;i<=m;i++) c[i]=-1;
    int p=1;
    while(p<n) p*=2;
    it++;
    build(1,1,p);
    for(int i=0;i<n-1;i++) push(1,a[i+1]);
    push(1,0);
    vector<int>X,Y;
    for(int i=1;i<=it;i++) X.pb(x[i]);
    for(int i=1;i<=it;i++) Y.pb(y[i]);
    answer(c,X,Y);
}
 
/*int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    create_circuit(5,{1,2,1,1,1});
 
    return 0;
}*/
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 38 ms 4300 KB Output is correct
3 Correct 34 ms 3792 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 10 ms 1468 KB Output is correct
6 Correct 52 ms 5712 KB Output is correct
7 Runtime error 53 ms 83412 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 38 ms 4300 KB Output is correct
3 Correct 34 ms 3792 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 10 ms 1468 KB Output is correct
6 Correct 52 ms 5712 KB Output is correct
7 Runtime error 53 ms 83412 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 38 ms 4300 KB Output is correct
3 Correct 34 ms 3792 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 10 ms 1468 KB Output is correct
6 Correct 52 ms 5712 KB Output is correct
7 Runtime error 53 ms 83412 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 268 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 57 ms 5812 KB Output is correct
3 Correct 63 ms 5684 KB Output is correct
4 Correct 107 ms 8560 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 57 ms 5812 KB Output is correct
3 Correct 63 ms 5684 KB Output is correct
4 Correct 107 ms 8560 KB Output is correct
5 Correct 116 ms 8984 KB Output is correct
6 Correct 112 ms 8780 KB Output is correct
7 Correct 101 ms 8796 KB Output is correct
8 Correct 96 ms 8604 KB Output is correct
9 Correct 63 ms 5740 KB Output is correct
10 Correct 97 ms 8588 KB Output is correct
11 Correct 91 ms 8632 KB Output is correct
12 Correct 59 ms 5692 KB Output is correct
13 Correct 59 ms 5896 KB Output is correct
14 Correct 62 ms 6048 KB Output is correct
15 Correct 68 ms 6168 KB Output is correct
16 Correct 2 ms 468 KB Output is correct
17 Correct 62 ms 5828 KB Output is correct
18 Correct 66 ms 5836 KB Output is correct
19 Correct 63 ms 5688 KB Output is correct
20 Correct 94 ms 8644 KB Output is correct
21 Correct 99 ms 8640 KB Output is correct
22 Correct 95 ms 8572 KB Output is correct