답안 #1026734

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1026734 2024-07-18T09:56:14 Z nisanduu 자동 인형 (IOI18_doll) C++14
2 / 100
13 ms 2392 KB
#include "doll.h"
#include <bits/stdc++.h>

using namespace std;

void create_circuit(int M, std::vector<int> A) {
  int N = A.size();
  std::vector<int> C(M + 1,-1);
  vector<int> unused;
  int sz = A.size();
  C[0] = A[0];
  for(int i=0;i<(A.size()-1);i++){
    C[A[i]] = A[i+1];
  }
  C[A[sz-1]]=0;
  for(int i=0;i<(M+1);i++){
      if(C[i]==-1){
          unused.push_back(i);
      }
  }
  sz = unused.size();
  for(int i=0;i<(sz-1);i++){
      C[unused[i]] = unused[i+1];
  }
  vector<int> X,Y;
  if(sz>0){
      C[unused[sz-1]] = -1;
      X.push_back(0);
      Y.push_back(-1);
  }
  //std::vector<int> X(N), Y(N);
  answer(C, X, Y);
}

Compilation message

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:12:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |   for(int i=0;i<(A.size()-1);i++){
      |               ~^~~~~~~~~~~~~
doll.cpp:7:7: warning: unused variable 'N' [-Wunused-variable]
    7 |   int N = A.size();
      |       ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 11 ms 2364 KB Output is correct
3 Correct 8 ms 1624 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 6 ms 2004 KB Output is correct
6 Correct 13 ms 2392 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 11 ms 2364 KB Output is correct
3 Correct 8 ms 1624 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 6 ms 2004 KB Output is correct
6 Correct 13 ms 2392 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Incorrect 13 ms 2240 KB wrong motion
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 11 ms 2364 KB Output is correct
3 Correct 8 ms 1624 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 6 ms 2004 KB Output is correct
6 Correct 13 ms 2392 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Incorrect 13 ms 2240 KB wrong motion
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB wrong motion
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB wrong motion
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB wrong motion
2 Halted 0 ms 0 KB -