Submission #972778

# Submission time Handle Problem Language Result Execution time Memory
972778 2024-05-01T07:11:29 Z kwongweng Mechanical Doll (IOI18_doll) C++17
6 / 100
60 ms 12460 KB
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long double ld;
typedef vector<vector<ll>> vll;
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define ROF(i, a, b) for(int i = a; i >= b; i--)
#define pb push_back
#define ms memset
#define fi first
#define se second

void create_circuit(int M, vi A) {
  int N = A.size();
  vi C(M + 1);
  C[0] = A[0];
  vi nxt[M+1];
  FOR(i,0,N-1){
    nxt[A[i]].pb(A[i+1]);
  }
  nxt[A[N-1]].pb(0);
  int cur = 1; vi X,Y;
  FOR(i,1,M+1){
    if (nxt[i].size()==1) C[i] = nxt[i][0];
    if (nxt[i].size()==2){
      C[i] = -cur; cur++;
      X.pb(nxt[i][0]); Y.pb(nxt[i][1]);
    }
    if (nxt[i].size()==3){
      C[i] = -cur;
      X.pb(-cur-1); Y.pb(-cur-2);
      X.pb(nxt[i][0]); Y.pb(-cur);
      X.pb(nxt[i][1]); Y.pb(nxt[i][2]);
      cur += 3;
    }
    if (nxt[i].size()==4){
      C[i] = -cur;
      X.pb(-cur-1); Y.pb(-cur-2);
      X.pb(nxt[i][0]); Y.pb(nxt[i][1]);
      X.pb(nxt[i][2]); Y.pb(nxt[i][3]);
      cur += 3;
    }
  }
  answer(C, X, Y);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 19 ms 6836 KB Output is correct
3 Correct 16 ms 5724 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 9 ms 3932 KB Output is correct
6 Correct 24 ms 8540 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 19 ms 6836 KB Output is correct
3 Correct 16 ms 5724 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 9 ms 3932 KB Output is correct
6 Correct 24 ms 8540 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 32 ms 8152 KB Output is correct
9 Correct 38 ms 9808 KB Output is correct
10 Correct 51 ms 12460 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 19 ms 6836 KB Output is correct
3 Correct 16 ms 5724 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 9 ms 3932 KB Output is correct
6 Correct 24 ms 8540 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 32 ms 8152 KB Output is correct
9 Correct 38 ms 9808 KB Output is correct
10 Correct 51 ms 12460 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 60 ms 12392 KB Output is correct
15 Incorrect 33 ms 6860 KB wrong motion
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB wrong motion
2 Halted 0 ms 0 KB -