답안 #740443

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
740443 2023-05-12T13:23:12 Z danikoynov 자동 인형 (IOI18_doll) C++14
16 / 100
84 ms 14944 KB
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int maxn = 2e5 + 10;

int n, m;
vector < int > g[maxn];
void create_circuit(int M, vector<int> A)
{
    n = A.size();
    m = M;

    vector < int > c(m + 1);
    g[0].push_back(A[0]);
    for (int i = 1; i < A.size(); i ++)
    {
        g[A[i - 1]].push_back(A[i]);
    }
    g[A.back()].push_back(0);
    vector < int > x, y;
    for (int i = 0; i <= m; i ++)
    {
        if (g[i].size() == 0)
            c[i] = 0;
        else
        if (g[i].size() == 1)
        c[i] = g[i][0];
        else
        if (g[i].size() == 2)
        {
            x.push_back(g[i][0]);
            y.push_back(g[i][1]);
            int dev = x.size();
            c[i] = -dev;
        }
        else
        if (g[i].size() == 3)
        {
            int dev = x.size() + 1;
            x.push_back(- (dev + 1));
            y.push_back(- (dev + 2));
            c[i] = - dev;
            x.push_back(g[i][0]);
            y.push_back(- dev);
            x.push_back(g[i][1]);
            y.push_back(g[i][2]);
        }
        else
        {
            int dev = x.size() + 1;
            x.push_back(- (dev + 1));
            y.push_back(- (dev + 2));
            c[i] = -dev;
            x.push_back(g[i][0]);
            y.push_back(g[i][2]);
            x.push_back(g[i][1]);
            y.push_back(g[i][3]);
        }
    }
    /**for (int i = 0; i <= m; i ++)
        cout << c[i] << " ";
    cout << endl;
    for (int i = 0; i < x.size(); i ++)
        cout << x[i] << " " << y[i] << endl;*/
    answer(c, x, y);
}

Compilation message

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:17:23: 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 = 1; i < A.size(); i ++)
      |                     ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 27 ms 8692 KB Output is correct
3 Correct 22 ms 8356 KB Output is correct
4 Correct 3 ms 4948 KB Output is correct
5 Correct 10 ms 6100 KB Output is correct
6 Correct 31 ms 10004 KB Output is correct
7 Correct 2 ms 4948 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 27 ms 8692 KB Output is correct
3 Correct 22 ms 8356 KB Output is correct
4 Correct 3 ms 4948 KB Output is correct
5 Correct 10 ms 6100 KB Output is correct
6 Correct 31 ms 10004 KB Output is correct
7 Correct 2 ms 4948 KB Output is correct
8 Correct 49 ms 10328 KB Output is correct
9 Correct 45 ms 11024 KB Output is correct
10 Correct 66 ms 13320 KB Output is correct
11 Correct 2 ms 4948 KB Output is correct
12 Correct 4 ms 4948 KB Output is correct
13 Correct 3 ms 4948 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 27 ms 8692 KB Output is correct
3 Correct 22 ms 8356 KB Output is correct
4 Correct 3 ms 4948 KB Output is correct
5 Correct 10 ms 6100 KB Output is correct
6 Correct 31 ms 10004 KB Output is correct
7 Correct 2 ms 4948 KB Output is correct
8 Correct 49 ms 10328 KB Output is correct
9 Correct 45 ms 11024 KB Output is correct
10 Correct 66 ms 13320 KB Output is correct
11 Correct 2 ms 4948 KB Output is correct
12 Correct 4 ms 4948 KB Output is correct
13 Correct 3 ms 4948 KB Output is correct
14 Correct 84 ms 14064 KB Output is correct
15 Correct 43 ms 10688 KB Output is correct
16 Correct 64 ms 13616 KB Output is correct
17 Correct 4 ms 4948 KB Output is correct
18 Correct 3 ms 4948 KB Output is correct
19 Correct 3 ms 4996 KB Output is correct
20 Correct 72 ms 14944 KB Output is correct
21 Correct 3 ms 5000 KB Output is correct
22 Correct 3 ms 4948 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 4948 KB wrong motion
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4948 KB wrong motion
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4948 KB wrong motion
2 Halted 0 ms 0 KB -