답안 #1055335

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1055335 2024-08-12T17:37:13 Z Ahmed57 자동 인형 (IOI18_doll) C++17
47 / 100
73 ms 13980 KB
#include "bits/stdc++.h"
#include "doll.h"
 
using namespace std;
int S = -1;
vector<int> X,Y,C;
vector<int> dc(vector<int> lol){
    if(lol.size()==1)return lol;
    int sz = lol.size();
    int add = sz/2;
    vector<int> ret;
    for(int j = 0;j+add<sz;j++){
        if(lol[j]==-1e9&&lol[j+add]==-1e9){
            ret.push_back(-1e9);
            continue;
        }
        if(lol[j]==-1e9)X.push_back(-1e9);
        else X.push_back(lol[j]);
        Y.push_back(lol[j+add]);
        ret.push_back(S--);
    }
    return dc(ret);
}
void create_circuit(int M, vector<int> A){
    S = -1;
    X.clear();
    Y.clear();
    C.clear();
    vector<int> adj[M+1];
    int N = A.size();
    vector<int> lo;
    for(int i = 1;i<N;i++){
        lo.push_back(A[i]);
    }
    lo.push_back(0);
    int rem = 1;
    while(rem<lo.size())rem*=2;
    vector<int> fin;
    while(rem>lo.size()){fin.push_back(-1e9);rem--;}
    for(auto i:lo)fin.push_back(i);
    vector<int> e = dc(fin);
    C.push_back(A[0]);
    for(int i = 0;i<X.size();i++){
        if(X[i]==-1e9)X[i] = e[0];
        if(Y[i]==-1e9)Y[i] = e[0];
    }
    for(int i = 1;i<=M;i++){
        if(rem==0)C.push_back(0);
        else C.push_back(e[0]);
    }
    answer(C,X,Y);
}

Compilation message

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:37:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |     while(rem<lo.size())rem*=2;
      |           ~~~^~~~~~~~~~
doll.cpp:39:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |     while(rem>lo.size()){fin.push_back(-1e9);rem--;}
      |           ~~~^~~~~~~~~~
doll.cpp:43:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |     for(int i = 0;i<X.size();i++){
      |                   ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 348 KB Output is partially correct
2 Correct 20 ms 5688 KB Output is correct
3 Partially correct 33 ms 10940 KB Output is partially correct
4 Partially correct 36 ms 10656 KB Output is partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 348 KB Output is partially correct
2 Correct 20 ms 5688 KB Output is correct
3 Partially correct 33 ms 10940 KB Output is partially correct
4 Partially correct 36 ms 10656 KB Output is partially correct
5 Partially correct 42 ms 13980 KB Output is partially correct
6 Partially correct 39 ms 12192 KB Output is partially correct
7 Partially correct 39 ms 12192 KB Output is partially correct
8 Partially correct 41 ms 11684 KB Output is partially correct
9 Partially correct 32 ms 10940 KB Output is partially correct
10 Partially correct 36 ms 11472 KB Output is partially correct
11 Partially correct 73 ms 11008 KB Output is partially correct
12 Partially correct 33 ms 11204 KB Output is partially correct
13 Correct 21 ms 6280 KB Output is correct
14 Partially correct 34 ms 11872 KB Output is partially correct
15 Partially correct 34 ms 12220 KB Output is partially correct
16 Partially correct 1 ms 604 KB Output is partially correct
17 Correct 37 ms 5692 KB Output is correct
18 Correct 22 ms 5696 KB Output is correct
19 Partially correct 34 ms 10948 KB Output is partially correct
20 Partially correct 44 ms 11320 KB Output is partially correct
21 Partially correct 50 ms 11100 KB Output is partially correct
22 Partially correct 37 ms 10984 KB Output is partially correct