답안 #1055338

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1055338 2024-08-12T17:38:53 Z Ahmed57 자동 인형 (IOI18_doll) C++17
47 / 100
42 ms 13736 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 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 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 23 ms 5688 KB Output is correct
3 Partially correct 33 ms 10948 KB Output is partially correct
4 Partially correct 35 ms 10744 KB Output is partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 348 KB Output is partially correct
2 Correct 23 ms 5688 KB Output is correct
3 Partially correct 33 ms 10948 KB Output is partially correct
4 Partially correct 35 ms 10744 KB Output is partially correct
5 Partially correct 40 ms 13736 KB Output is partially correct
6 Partially correct 41 ms 12048 KB Output is partially correct
7 Partially correct 41 ms 12388 KB Output is partially correct
8 Partially correct 39 ms 11684 KB Output is partially correct
9 Partially correct 32 ms 10948 KB Output is partially correct
10 Partially correct 37 ms 11420 KB Output is partially correct
11 Partially correct 36 ms 11168 KB Output is partially correct
12 Partially correct 32 ms 10940 KB Output is partially correct
13 Correct 21 ms 6340 KB Output is correct
14 Partially correct 36 ms 11964 KB Output is partially correct
15 Partially correct 34 ms 12216 KB Output is partially correct
16 Partially correct 2 ms 600 KB Output is partially correct
17 Correct 19 ms 5792 KB Output is correct
18 Correct 24 ms 5840 KB Output is correct
19 Partially correct 39 ms 10932 KB Output is partially correct
20 Partially correct 42 ms 11688 KB Output is partially correct
21 Partially correct 38 ms 10916 KB Output is partially correct
22 Partially correct 36 ms 11172 KB Output is partially correct