Submission #740438

# Submission time Handle Problem Language Result Execution time Memory
740438 2023-05-12T13:16:34 Z danikoynov Mechanical Doll (IOI18_doll) C++14
6 / 100
68 ms 14856 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;
        }
    }
    /**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 ++)
      |                     ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4948 KB Output is correct
2 Correct 24 ms 8724 KB Output is correct
3 Correct 21 ms 8340 KB Output is correct
4 Correct 2 ms 4948 KB Output is correct
5 Correct 11 ms 6100 KB Output is correct
6 Correct 28 ms 10068 KB Output is correct
7 Correct 2 ms 4948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4948 KB Output is correct
2 Correct 24 ms 8724 KB Output is correct
3 Correct 21 ms 8340 KB Output is correct
4 Correct 2 ms 4948 KB Output is correct
5 Correct 11 ms 6100 KB Output is correct
6 Correct 28 ms 10068 KB Output is correct
7 Correct 2 ms 4948 KB Output is correct
8 Correct 44 ms 10388 KB Output is correct
9 Correct 47 ms 11848 KB Output is correct
10 Correct 68 ms 14856 KB Output is correct
11 Correct 2 ms 4948 KB Output is correct
12 Correct 3 ms 4948 KB Output is correct
13 Correct 3 ms 4948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4948 KB Output is correct
2 Correct 24 ms 8724 KB Output is correct
3 Correct 21 ms 8340 KB Output is correct
4 Correct 2 ms 4948 KB Output is correct
5 Correct 11 ms 6100 KB Output is correct
6 Correct 28 ms 10068 KB Output is correct
7 Correct 2 ms 4948 KB Output is correct
8 Correct 44 ms 10388 KB Output is correct
9 Correct 47 ms 11848 KB Output is correct
10 Correct 68 ms 14856 KB Output is correct
11 Correct 2 ms 4948 KB Output is correct
12 Correct 3 ms 4948 KB Output is correct
13 Correct 3 ms 4948 KB Output is correct
14 Incorrect 44 ms 10792 KB wrong motion
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 4948 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 4948 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 4948 KB wrong motion
2 Halted 0 ms 0 KB -