답안 #946509

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
946509 2024-03-14T17:30:44 Z PagodePaiva 자동 인형 (IOI18_doll) C++17
16 / 100
60 ms 13456 KB
#include "doll.h"
#include<bits/stdc++.h>

using namespace std;

void create_circuit(int M, std::vector<int> A) {
  vector <int> v;
  v.push_back(0);
  for(auto x : A) v.push_back(x);
  int m = M;
  int n = v.size();
  vector <int> c, x, y;
  vector <int> g[m+1];
  v.push_back(0);
  for(int i = 0;i < (int) (v.size()) - 1;i++){
    int val = v[i], nx = v[i+1];
    g[val].push_back(nx);
  }
  int tp = -1;
  for(int i = 0;i <= m;i++){
    if(g[i].size() == 0) {
      c.push_back(0);
      continue;
    }
    if(g[i].size() == 1){
      c.push_back(g[i][0]);
      continue;
    }
    if(g[i].size() == 2){
      c.push_back(tp);
      x.push_back(g[i][0]);
      y.push_back(g[i][1]);
      tp--;
      continue;
    }
    if(g[i].size() == 3){
      c.push_back(tp);
      x.push_back(tp-1);
      y.push_back(tp-2);
      x.push_back(g[i][0]);
      y.push_back(tp);
      x.push_back(g[i][1]);
      y.push_back(g[i][2]);
      tp--;
      tp--;
      tp--;
      continue;
    }
    if(g[i].size() == 4){
      c.push_back(tp);
      x.push_back(tp-1);
      y.push_back(tp-2);
      x.push_back(g[i][0]);
      y.push_back(g[i][2]);
      x.push_back(g[i][1]);
      y.push_back(g[i][3]);
      tp--;
      tp--;
      tp--;
      continue;
    }
  }
  // for(auto t : c){
  //   cout << t << ' ';
  // }
  answer(c, x, y);
  return;
}

Compilation message

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:11:7: warning: unused variable 'n' [-Wunused-variable]
   11 |   int n = v.size();
      |       ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 20 ms 6744 KB Output is correct
3 Correct 16 ms 5536 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 9 ms 4052 KB Output is correct
6 Correct 25 ms 8280 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 20 ms 6744 KB Output is correct
3 Correct 16 ms 5536 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 9 ms 4052 KB Output is correct
6 Correct 25 ms 8280 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 36 ms 8224 KB Output is correct
9 Correct 41 ms 9544 KB Output is correct
10 Correct 50 ms 12124 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 20 ms 6744 KB Output is correct
3 Correct 16 ms 5536 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 9 ms 4052 KB Output is correct
6 Correct 25 ms 8280 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 36 ms 8224 KB Output is correct
9 Correct 41 ms 9544 KB Output is correct
10 Correct 50 ms 12124 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 60 ms 12132 KB Output is correct
15 Correct 51 ms 8128 KB Output is correct
16 Correct 50 ms 11232 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 59 ms 13456 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Wrong Answer: wrong array length
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Wrong Answer: wrong array length
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Wrong Answer: wrong array length
2 Halted 0 ms 0 KB -