답안 #816053

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
816053 2023-08-09T04:05:50 Z Jarif_Rahman 자동 인형 (IOI18_doll) C++17
16 / 100
76 ms 11724 KB
#include "doll.h"
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;

const int inf = 1e9;

void create_circuit(int m, vector<int> A){
    int n = A.size();
    A.pb(inf);
    vector<vector<int>> pos(m);
    for(int i = 0; i < n; i++) pos[A[i]-1].pb(i);

    vector<int> C(m+1, 0), X, Y;
    C[0] = A[0];
    int ls = 0;
    for(int i = 0; i < m; i++) if(!pos[i].empty()){
        if(pos[i].size() == 1){
            C[i+1] = A[pos[i][0]+1];
        }
        else if(pos[i].size() == 2){
            X.pb(A[pos[i][0]+1]), Y.pb(A[pos[i][1]+1]);
            C[i+1] = -int(X.size());
        }
        else if(pos[i].size() == 4){
            C[i+1] = -int(X.size()+1);
            X.pb(-int(X.size()+2)), Y.pb(-int(Y.size()+3));
            X.pb(A[pos[i][0]+1]), X.pb(A[pos[i][1]+1]);
            Y.pb(A[pos[i][2]+1]), Y.pb(A[pos[i][3]+1]);
        }
        else{
            C[i+1] = -int(X.size()+1);
            X.pb(-int(X.size()+2)), Y.pb(-int(Y.size()+3));
            X.pb(A[pos[i][0]+1]), X.pb(A[pos[i][1]+1]);
            Y.pb(A[pos[i][2]+1]), Y.pb(ls);
            ls = -int(X.size())+2;
        }
    }

    for(int &x: C) if(x == inf) x = ls;
    for(int &x: X) if(x == inf) x = ls;
    for(int &x: Y) if(x == inf) x = ls;

    answer(C, X, Y);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 26 ms 6832 KB Output is correct
3 Correct 24 ms 5648 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 12 ms 3796 KB Output is correct
6 Correct 40 ms 8192 KB Output is correct
7 Correct 1 ms 304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 26 ms 6832 KB Output is correct
3 Correct 24 ms 5648 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 12 ms 3796 KB Output is correct
6 Correct 40 ms 8192 KB Output is correct
7 Correct 1 ms 304 KB Output is correct
8 Correct 34 ms 7752 KB Output is correct
9 Correct 66 ms 9156 KB Output is correct
10 Correct 70 ms 11724 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 26 ms 6832 KB Output is correct
3 Correct 24 ms 5648 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 12 ms 3796 KB Output is correct
6 Correct 40 ms 8192 KB Output is correct
7 Correct 1 ms 304 KB Output is correct
8 Correct 34 ms 7752 KB Output is correct
9 Correct 66 ms 9156 KB Output is correct
10 Correct 70 ms 11724 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 76 ms 11460 KB Output is correct
15 Correct 33 ms 6772 KB Output is correct
16 Correct 69 ms 9272 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 73 ms 11328 KB Output is correct
21 Correct 1 ms 300 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 304 KB wrong motion
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB wrong motion
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB wrong motion
2 Halted 0 ms 0 KB -