Submission #1032766

# Submission time Handle Problem Language Result Execution time Memory
1032766 2024-07-24T08:16:59 Z amirhoseinfar1385 Mechanical Doll (IOI18_doll) C++17
0 / 100
32 ms 6068 KB
#include "doll.h"
#include<bits/stdc++.h>
using namespace std;
const int maxn=100000+10;
vector<int>c(maxn),x(maxn),y(maxn);
int lnk[maxn],s;

void adde(int u,int v){
  s++;
  x[s]=y[s]=-s;
  if(lnk[u]==0){
    c[u]=-s;
    y[s]=v;
    lnk[u]=s;
    return ;
  } 
  swap(x[lnk[u]],y[lnk[u]]);
  y[lnk[u]]=-s;
  lnk[u]=s;
  y[s]=v;
}

void create_circuit(int M, std::vector<int> A) {
  int n = A.size();
  s=0;  
  int now=0;
  for(int i=0;i<n;i++){
    adde(now,A[i]);
    now=A[i];
  }
  adde(now,0);
  c.resize(M+1);
  for(int i=0;i<s;i++){
    x[i]=x[i+1];
    y[i]=y[i+1];
  }
  x.resize(s);
  y.resize(s);
 /* for(auto i:c){
    cout<<i<<" ";
  }
  cout<<endl;
  for(auto i:x){
    cout<<i<<" ";
  }
  cout<<endl;
  for(auto i:y){
    cout<<i<<" ";
  }
  cout<<endl;*/
  answer(c, x, y);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1880 KB Output is correct
2 Correct 21 ms 4808 KB Output is correct
3 Correct 16 ms 4428 KB Output is correct
4 Correct 1 ms 1624 KB Output is correct
5 Correct 6 ms 2396 KB Output is correct
6 Correct 32 ms 6068 KB Output is correct
7 Incorrect 1 ms 1624 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1880 KB Output is correct
2 Correct 21 ms 4808 KB Output is correct
3 Correct 16 ms 4428 KB Output is correct
4 Correct 1 ms 1624 KB Output is correct
5 Correct 6 ms 2396 KB Output is correct
6 Correct 32 ms 6068 KB Output is correct
7 Incorrect 1 ms 1624 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1880 KB Output is correct
2 Correct 21 ms 4808 KB Output is correct
3 Correct 16 ms 4428 KB Output is correct
4 Correct 1 ms 1624 KB Output is correct
5 Correct 6 ms 2396 KB Output is correct
6 Correct 32 ms 6068 KB Output is correct
7 Incorrect 1 ms 1624 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1624 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1624 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1624 KB wrong motion
2 Halted 0 ms 0 KB -