Submission #999336

# Submission time Handle Problem Language Result Execution time Memory
999336 2024-06-15T10:14:30 Z MarwenElarbi Mechanical Doll (IOI18_doll) C++17
6 / 100
116 ms 16556 KB
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define ll long long
#define pb push_back
#define ii pair<int,int>
const int nax=2e5+5;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
vector<int> adj[nax];
int vis[nax];
int counter=0;
void answer(std::vector<int> C, std::vector<int> X, std::vector<int> Y);
void create_circuit(int M, std::vector<int> A) {
  vector<int> X,Y;
  vector<int> C(M+1);
  C[0]=A[0];
  int N = A.size();
  A.pb(0);
  for (int i = 0; i < N; ++i)
  {
    adj[A[i]].pb(A[i+1]);
  }
  for (int i = 0; i < N; ++i)
  {
    if(vis[A[i]]>0) continue;
    vis[A[i]]=1;
    if(adj[A[i]].size()==1){
      C[A[i]]=A[i+1];
      continue;
    }
    X.emplace_back();
    Y.emplace_back();
    C[A[i]]=-(int)(X.size());
    for (int j = 0; j < adj[A[i]].size()-2; ++j)
    {
      cout <<A[i]<<" "<<j<<endl;
      X.back()=adj[A[i]][j];
      Y.back()=-((int)X.size()+1);
      X.emplace_back();
      Y.emplace_back();
    }
    X.back()=adj[A[i]][adj[A[i]].size()-2];
    Y.back()=adj[A[i]][adj[A[i]].size()-1];
  }
  /*for (int i = 0; i < M+1; ++i)
  {
    cout << C[i]<<" ";
  }cout <<endl;
  for (int i = 0; i < X.size(); ++i)
  {
    cout <<X[i]<<" ";
  }cout <<endl;
  for (int i = 0; i < Y.size(); ++i)
  {
    cout <<Y[i]<<" ";
  }cout <<endl;*/
  answer(C, X, Y);
}

Compilation message

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:35:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |     for (int j = 0; j < adj[A[i]].size()-2; ++j)
      |                     ~~^~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 5748 KB Output is correct
2 Correct 16 ms 10108 KB Output is correct
3 Correct 15 ms 9560 KB Output is correct
4 Correct 1 ms 5724 KB Output is correct
5 Correct 6 ms 6844 KB Output is correct
6 Correct 19 ms 11476 KB Output is correct
7 Correct 1 ms 5724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 5748 KB Output is correct
2 Correct 16 ms 10108 KB Output is correct
3 Correct 15 ms 9560 KB Output is correct
4 Correct 1 ms 5724 KB Output is correct
5 Correct 6 ms 6844 KB Output is correct
6 Correct 19 ms 11476 KB Output is correct
7 Correct 1 ms 5724 KB Output is correct
8 Correct 29 ms 12624 KB Output is correct
9 Correct 28 ms 12992 KB Output is correct
10 Correct 41 ms 16556 KB Output is correct
11 Correct 2 ms 5748 KB Output is correct
12 Correct 1 ms 5724 KB Output is correct
13 Correct 1 ms 5724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 5748 KB Output is correct
2 Correct 16 ms 10108 KB Output is correct
3 Correct 15 ms 9560 KB Output is correct
4 Correct 1 ms 5724 KB Output is correct
5 Correct 6 ms 6844 KB Output is correct
6 Correct 19 ms 11476 KB Output is correct
7 Correct 1 ms 5724 KB Output is correct
8 Correct 29 ms 12624 KB Output is correct
9 Correct 28 ms 12992 KB Output is correct
10 Correct 41 ms 16556 KB Output is correct
11 Correct 2 ms 5748 KB Output is correct
12 Correct 1 ms 5724 KB Output is correct
13 Correct 1 ms 5724 KB Output is correct
14 Incorrect 116 ms 15468 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 5724 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 5720 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 5720 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -