답안 #75298

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

vector<int> A, X, Y, C;
int dep[200];
int nextSwitch = -1;
vector<int> AdjList[200005];

void buildTree(int curSwitch, int curTrigger) {

}

void create_circuit(int M, vector<int> A_) {
  A = A_;
  AdjList[0].push_back(A[0]);
  for(int i = 0; i+1 < A.size(); i++) {
    AdjList[A[i]].push_back(A[i+1]);
  }
  AdjList[A.back()].push_back(0);

  C.assign(M+1, 0);
  for(int i = 0; i <= M; i++) {
    if(AdjList[i].size() == 0) {
    } else if(AdjList[i].size() == 1) {
      C[i] = AdjList[i][0];
    } else {
      C[i] = nextSwitch--;
      buildTree(C[i], i);
    }
  }

  // cerr << nextSwitch << endl;
  // for(int i = 1; dep[i]; i++)
    // cerr << i << ": " << dep[i] << endl;
  // 
  // cerr << N << " " << X.size() << endl;


  answer(C, X, Y);
}

Compilation message

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:17:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |   for(int i = 0; i+1 < A.size(); i++) {
      |                  ~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4940 KB Output is correct
2 Correct 33 ms 8944 KB Output is correct
3 Correct 34 ms 8584 KB Output is correct
4 Correct 4 ms 4940 KB Output is correct
5 Correct 14 ms 6092 KB Output is correct
6 Correct 41 ms 10436 KB Output is correct
7 Correct 4 ms 4940 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4940 KB Output is correct
2 Correct 33 ms 8944 KB Output is correct
3 Correct 34 ms 8584 KB Output is correct
4 Correct 4 ms 4940 KB Output is correct
5 Correct 14 ms 6092 KB Output is correct
6 Correct 41 ms 10436 KB Output is correct
7 Correct 4 ms 4940 KB Output is correct
8 Incorrect 66 ms 9352 KB wrong serial number
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4940 KB Output is correct
2 Correct 33 ms 8944 KB Output is correct
3 Correct 34 ms 8584 KB Output is correct
4 Correct 4 ms 4940 KB Output is correct
5 Correct 14 ms 6092 KB Output is correct
6 Correct 41 ms 10436 KB Output is correct
7 Correct 4 ms 4940 KB Output is correct
8 Incorrect 66 ms 9352 KB wrong serial number
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 4940 KB wrong serial number
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 4896 KB wrong serial number
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 4896 KB wrong serial number
2 Halted 0 ms 0 KB -