답안 #1013481

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1013481 2024-07-03T15:00:42 Z c2zi6 자동 인형 (IOI18_doll) C++14
24 / 100
36 ms 8648 KB
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define replr(i, a, b) for (int i = int(a); i <= int(b); ++i)
#define reprl(i, a, b) for (int i = int(a); i >= int(b); --i)
#define rep(i, n) for (int i = 0; i < int(n); ++i)
#define mkp(a, b) make_pair(a, b)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VPI;
typedef vector<VI> VVI;
typedef vector<VVI> VVVI;
typedef vector<VPI> VVPI;
typedef pair<ll, ll> PLL;
typedef vector<ll> VL;
typedef vector<PLL> VPL;
typedef vector<VL> VVL;
typedef vector<VVL> VVVL;
typedef vector<VPL> VVPL;
template<class T> T setmax(T& a, T b) {if (a < b) return a = b; return a;}
template<class T> T setmin(T& a, T b) {if (a < b) return a; return a = b;}
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T>
using indset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#include "doll.h"

namespace TEST2 {
    void solve(int M, VI A) {
        VI C, X, Y;
        C = VI(M+1);
        VI cnt(M+1);
        for (int x : A) cnt[x]++;
        VI sw(M+1, -1);
        int u = 0;
        for (int v : A) {
            if (cnt[u] == 2) {
                if (sw[u] == -1) {
                    sw[u] = X.size();
                    C[u] = -(sw[u]+1);
                    X.pb(0);
                    Y.pb(0);
                    X[sw[u]] = v;

                } else {
                    Y[sw[u]] = v;
                }
            } else {
                C[u] = v;
            }
            u = v;
        }
        answer(C, X, Y);
    }
};
namespace TEST3 {
    void solve(int M, VI A) {
        int N = A.size();
        VI C;
        VI X;
        VI Y;
        if (A.size() == 1) {
            C.pb(1);
            C.pb(0);
            answer(C, X, Y);
            return;
        }
        C.pb(1);
        C.pb(-1);
        int s = 0;
        while ((1<<s) < N) s++;
        replr(i, 2, s+1) {
            X.pb(-1);
            Y.pb(-i);
        }
        Y.back() = 0;
        int n = N-1;
        rep(i, s) {
            if (n & (1<<i)) {
                X[s-1-i] = 1;
            }
        }
        answer(C, X, Y);
    }
};

void create_circuit(int M, VI A) {
    if (M == 1) TEST3::solve(M, A);
    else TEST2::solve(M, A);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 19 ms 3416 KB Output is correct
3 Correct 16 ms 2792 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 9 ms 2392 KB Output is correct
6 Correct 25 ms 4188 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 19 ms 3416 KB Output is correct
3 Correct 16 ms 2792 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 9 ms 2392 KB Output is correct
6 Correct 25 ms 4188 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 21 ms 5928 KB Output is correct
9 Correct 31 ms 5848 KB Output is correct
10 Correct 36 ms 8648 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 19 ms 3416 KB Output is correct
3 Correct 16 ms 2792 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 9 ms 2392 KB Output is correct
6 Correct 25 ms 4188 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 21 ms 5928 KB Output is correct
9 Correct 31 ms 5848 KB Output is correct
10 Correct 36 ms 8648 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Incorrect 29 ms 5468 KB wrong motion
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB wrong motion
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 9 ms 2732 KB Output is correct
3 Correct 10 ms 2868 KB Output is correct
4 Correct 15 ms 4184 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 9 ms 2732 KB Output is correct
3 Correct 10 ms 2868 KB Output is correct
4 Correct 15 ms 4184 KB Output is correct
5 Incorrect 34 ms 4948 KB wrong motion
6 Halted 0 ms 0 KB -