답안 #845513

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
845513 2023-09-06T13:57:25 Z 12345678 자동 인형 (IOI18_doll) C++17
16 / 100
65 ms 12308 KB
#include "doll.h"
#include <bits/stdc++.h>

using namespace std;

const int nx=2e5+1000;

void create_circuit(int M, std::vector<int> A) {
    int cnt=0;
    vector<int> C(M+1), X, Y, cl;
    vector<vector<int>> v(M+1);
    v[0].push_back(A[0]);
    for (int i=0; i<A.size()-1; i++) v[A[i]].push_back(A[i+1]);
    v[A[A.size()-1]].push_back(0);
    for (int i=0; i<=M; i++)
    {
        if (v[i].size()==0) continue;
        if (v[i].size()==1) C[i]=v[i][0];
        else if (v[i].size()==2)
        {
            C[i]=--cnt;
            X.push_back(v[i][0]);
            Y.push_back(v[i][1]);
        }
        else if (v[i].size()==3)
        {
            C[i]=--cnt;
            cl.push_back(cnt);
            X.push_back(--cnt);
            Y.push_back(--cnt);
            X.push_back(cnt+2);
            Y.push_back(v[i][1]);
            X.push_back(v[i][0]);
            Y.push_back(v[i][2]);
        }
        else
        {
            C[i]=--cnt;
            X.push_back(--cnt);
            Y.push_back(--cnt);
            X.push_back(v[i][0]);
            Y.push_back(v[i][2]);
            X.push_back(v[i][1]);
            Y.push_back(v[i][3]);
        }
    }
    answer(C, X, Y);
}

Compilation message

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:13:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for (int i=0; i<A.size()-1; i++) v[A[i]].push_back(A[i+1]);
      |                   ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 18 ms 6488 KB Output is correct
3 Correct 16 ms 5364 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 9 ms 3928 KB Output is correct
6 Correct 25 ms 7772 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 18 ms 6488 KB Output is correct
3 Correct 16 ms 5364 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 9 ms 3928 KB Output is correct
6 Correct 25 ms 7772 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 34 ms 7380 KB Output is correct
9 Correct 34 ms 8760 KB Output is correct
10 Correct 48 ms 11204 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 18 ms 6488 KB Output is correct
3 Correct 16 ms 5364 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 9 ms 3928 KB Output is correct
6 Correct 25 ms 7772 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 34 ms 7380 KB Output is correct
9 Correct 34 ms 8760 KB Output is correct
10 Correct 48 ms 11204 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 65 ms 11580 KB Output is correct
15 Correct 32 ms 6852 KB Output is correct
16 Correct 49 ms 10184 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 56 ms 12308 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 0 ms 600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB wrong motion
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB wrong motion
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB wrong motion
2 Halted 0 ms 0 KB -