답안 #75054

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
75054 2018-09-08T07:21:46 Z KieranHorgan 자동 인형 (IOI18_doll) C++17
2 / 100
74 ms 19456 KB
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;

pair<int, int> exits[400005];
vector<int> C, X, Y;

vector<int> afterInList[400005];
int nextSwitchIdx = -1;

int build(int i, vector<int> cur) {
  if(cur.size() == 1) {
    return cur[0];
  }

  if(X.size() < abs(i)) {
    X.resize(abs(i));
    Y.resize(abs(i));
  }

  vector<int> nextCur;
  for(int i = 0; i < cur.size(); i+=2)
    nextCur.push_back(cur[i]);
  X[i] = build(nextSwitchIdx--, nextCur);

  nextCur.clear();
  for(int i = 1; i < cur.size(); i+=2)
    nextCur.push_back(cur[i]);
  Y[i] = build(nextSwitchIdx--, nextCur);

  return i;
}

void create_circuit(int M, vector<int> A) {
  int N = A.size();
  C.assign(M+1, 0);

  afterInList[0].push_back(A[0]);
  for(int i = 0; i+1 < N; i++)
    afterInList[A[i]].push_back(A[i+1]);
  afterInList[A.back()].push_back(0);

  for(int i = 0; i <= M; i++) {
    if(afterInList[i].empty())
      continue;

    C[i] = build(i, afterInList[i]);
    // cerr << i << ": " << C[i] << endl;
  }
  // cerr << X.size() << endl;

  answer(C, X, Y);
}

Compilation message

doll.cpp: In function 'int build(int, std::vector<int>)':
doll.cpp:22:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |   for(int i = 0; i < cur.size(); i+=2)
      |                  ~~^~~~~~~~~~~~
doll.cpp:27:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |   for(int i = 1; i < cur.size(); i+=2)
      |                  ~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 9676 KB Output is correct
2 Correct 61 ms 13688 KB Output is correct
3 Correct 40 ms 13252 KB Output is correct
4 Correct 8 ms 9676 KB Output is correct
5 Correct 22 ms 10828 KB Output is correct
6 Correct 74 ms 14916 KB Output is correct
7 Correct 8 ms 9676 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 9676 KB Output is correct
2 Correct 61 ms 13688 KB Output is correct
3 Correct 40 ms 13252 KB Output is correct
4 Correct 8 ms 9676 KB Output is correct
5 Correct 22 ms 10828 KB Output is correct
6 Correct 74 ms 14916 KB Output is correct
7 Correct 8 ms 9676 KB Output is correct
8 Incorrect 73 ms 15440 KB wrong motion
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 9676 KB Output is correct
2 Correct 61 ms 13688 KB Output is correct
3 Correct 40 ms 13252 KB Output is correct
4 Correct 8 ms 9676 KB Output is correct
5 Correct 22 ms 10828 KB Output is correct
6 Correct 74 ms 14916 KB Output is correct
7 Correct 8 ms 9676 KB Output is correct
8 Incorrect 73 ms 15440 KB wrong motion
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 14 ms 19408 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 24 ms 19456 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 24 ms 19456 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -