답안 #788517

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
788517 2023-07-20T10:10:39 Z Andrey 자동 인형 (IOI18_doll) C++14
6 / 100
1000 ms 16588 KB
#include "doll.h"
#include<bits/stdc++.h>
using namespace std;

vector<int> haha[200001];
vector<int> idk(500001);
int br = 1;
vector<int> x(0);
vector<int> y(0);

void dude(int a) {
    x.push_back(0);
    y.push_back(0);
    int ind = br-1;
    br++;
    int z = 1;
    while(z*2 < a) {
        z*=2;
    }
    if(a-z == 1) {
        x[ind] = INT_MAX;
    }
    else {
        x[ind] = -br;
        dude(a-z);
    }
    if(z == 1) {
        y[ind] = INT_MAX;
    }
    else {
        y[ind] = -br;
        dude(z);
    }
}

void create_circuit(int m, vector<int> bruh) {
    vector<int> c(m+1);
    c[0] = bruh[0];
    int n = bruh.size();
    bruh.push_back(0);
    int a,z = 0,b,p,d,e;
    for(int i = 0; i < n; i++) {
        haha[bruh[i]].push_back(bruh[i+1]);
    }
    for(int i = 0; i < 200001; i++) {
        if(haha[i].empty()) {
            continue;
        }
        if(haha[i].size() == 1) {
            c[i] = haha[i][0];
        }
        else {
            c[i] = -br;
            dude(haha[i].size());
            p = 0;
            for(int j = 0; j < haha[i].size(); j++) {
                d = -c[i];
                if((++idk[d-1])%2) {
                    e = x[d-1];
                }
                else {
                    e = y[d-1];
                }
                while(e != INT_MAX) {
                    d = -e;
                    if((++idk[d-1])%2) {
                        e = x[d-1];
                    }
                    else {
                        e = y[d-1];
                    }
                }
                if(idk[d-1]%2 == 1) {
                    x[d-1] = haha[i][j];
                }
                else {
                    y[d-1] = haha[i][j];
                }
            }
        }
    }
    answer(c,x,y);
}

Compilation message

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:56:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |             for(int j = 0; j < haha[i].size(); j++) {
      |                            ~~^~~~~~~~~~~~~~~~
doll.cpp:41:9: warning: unused variable 'a' [-Wunused-variable]
   41 |     int a,z = 0,b,p,d,e;
      |         ^
doll.cpp:41:11: warning: unused variable 'z' [-Wunused-variable]
   41 |     int a,z = 0,b,p,d,e;
      |           ^
doll.cpp:41:17: warning: unused variable 'b' [-Wunused-variable]
   41 |     int a,z = 0,b,p,d,e;
      |                 ^
doll.cpp:41:19: warning: variable 'p' set but not used [-Wunused-but-set-variable]
   41 |     int a,z = 0,b,p,d,e;
      |                   ^
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 6968 KB Output is correct
2 Correct 24 ms 10832 KB Output is correct
3 Correct 18 ms 10544 KB Output is correct
4 Correct 3 ms 6868 KB Output is correct
5 Correct 10 ms 8124 KB Output is correct
6 Correct 25 ms 12104 KB Output is correct
7 Correct 3 ms 6868 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 6968 KB Output is correct
2 Correct 24 ms 10832 KB Output is correct
3 Correct 18 ms 10544 KB Output is correct
4 Correct 3 ms 6868 KB Output is correct
5 Correct 10 ms 8124 KB Output is correct
6 Correct 25 ms 12104 KB Output is correct
7 Correct 3 ms 6868 KB Output is correct
8 Correct 38 ms 12996 KB Output is correct
9 Correct 38 ms 13220 KB Output is correct
10 Correct 54 ms 16588 KB Output is correct
11 Correct 3 ms 6868 KB Output is correct
12 Correct 3 ms 6868 KB Output is correct
13 Correct 3 ms 6868 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 6968 KB Output is correct
2 Correct 24 ms 10832 KB Output is correct
3 Correct 18 ms 10544 KB Output is correct
4 Correct 3 ms 6868 KB Output is correct
5 Correct 10 ms 8124 KB Output is correct
6 Correct 25 ms 12104 KB Output is correct
7 Correct 3 ms 6868 KB Output is correct
8 Correct 38 ms 12996 KB Output is correct
9 Correct 38 ms 13220 KB Output is correct
10 Correct 54 ms 16588 KB Output is correct
11 Correct 3 ms 6868 KB Output is correct
12 Correct 3 ms 6868 KB Output is correct
13 Correct 3 ms 6868 KB Output is correct
14 Execution timed out 1062 ms 11004 KB Time limit exceeded
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 9 ms 13816 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 8 ms 13880 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 8 ms 13880 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -