답안 #988995

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
988995 2024-05-27T09:39:50 Z steveonalex 자동 인형 (IOI18_doll) C++17
6 / 100
45 ms 12868 KB
#include <bits/stdc++.h>
#include "doll.h"
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
#define MASK(i) (1ULL << (i))
#define GETBIT(mask, i) (((mask) >> (i)) & 1)
#define ALL(v) (v).begin(), (v).end()
 
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
 
ll LASTBIT(ll mask){return (mask) & (-mask);}
int pop_cnt(ll mask){return __builtin_popcountll(mask);}
int ctz(ull mask){return __builtin_ctzll(mask);}
int logOf(ull mask){return 63 - __builtin_clzll(mask);}
 
mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
ll rngesus(ll l, ll r){return l + (ull) rng() % (r - l + 1);}
 
template <class T1, class T2>
    bool maximize(T1 &a, T2 b){
        if (a < b) {a = b; return true;}
        return false;
    }
 
template <class T1, class T2>
    bool minimize(T1 &a, T2 b){
        if (a > b) {a = b; return true;}
        return false;
    }
 
template <class T>
    void printArr(T container, string separator = " ", string finish = "\n", ostream &out = cout){
        for(auto item: container) out << item << separator;
        out << finish;
    }
 
template <class T>
    void remove_dup(vector<T> &a){
        sort(ALL(a));
        a.resize(unique(ALL(a)) - a.begin());
    }

// void answer(vector<int> C, vector<int> X, vector<int> Y){
//     printArr(C); 
//     printArr(X); 
//     printArr(Y);
// }

void create_circuit(int m, vector<int> a) {
    int n = a.size();
    a.push_back(0);
    vector<vector<int>> fw(m+1);
    for(int i = 0; i<n; ++i){
        fw[a[i]].push_back(a[i+1]);
    }
    fw[0].push_back(a[0]);

    vector<int> C(m+1, 0);
    vector<int> X, Y;
    for(int i = 0; i<=m; ++i) {
        if (fw[i].size() > 2) exit(1);
        if (fw[i].size() == 0) continue;
        if (fw[i].size() == 1) C[i] = fw[i][0];
        if (fw[i].size() == 2){
            int cur = X.size(); cur = -cur - 1;
            C[i] = cur;
            X.push_back(fw[i][0]);
            Y.push_back(fw[i][1]);
        }
    }
    answer(C, X, Y);
}


// int main(void){
//     ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
//     create_circuit(4, {1, 2, 1, 3});   
 
//     return 0;
// }
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 18 ms 6488 KB Output is correct
3 Correct 15 ms 5720 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 6 ms 3932 KB Output is correct
6 Correct 24 ms 8544 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 18 ms 6488 KB Output is correct
3 Correct 15 ms 5720 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 6 ms 3932 KB Output is correct
6 Correct 24 ms 8544 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 30 ms 8280 KB Output is correct
9 Correct 33 ms 9512 KB Output is correct
10 Correct 45 ms 12868 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 18 ms 6488 KB Output is correct
3 Correct 15 ms 5720 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 6 ms 3932 KB Output is correct
6 Correct 24 ms 8544 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 30 ms 8280 KB Output is correct
9 Correct 33 ms 9512 KB Output is correct
10 Correct 45 ms 12868 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Runtime error 25 ms 7348 KB Execution failed because the return code was nonzero
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 348 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 348 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 348 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -