답안 #246864

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
246864 2020-07-10T12:37:52 Z srvlt 자동 인형 (IOI18_doll) C++14
6 / 100
121 ms 15456 KB
#include "doll.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define ld long double
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
template <typename T> using ord_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int n = 2e5 + 123;
int used[n];
vector <int> pos[n];

void create_circuit(int M, std::vector<int> A) {
  int N = A.size(), cnt = 0;
  A.pb(0);
  for (int i = 0; i < N; i++)
	pos[A[i]].pb(i);
  std::vector<int> C(M + 1), X(N), Y(N);
  C[0] = A[0];
  for (int i = 0; i < N; i++) {
	  if (used[A[i]]) continue;
	  used[A[i]] = 1;
	  if (SZ(pos[A[i]]) == 1) {
		  C[A[i]] = A[i + 1];
	  }	else {
		  C[A[i]] = -(++cnt);
		  for (int j = 1; j < SZ(pos[A[i]]); j++) {
			  int x = pos[A[i]][j];
			  if (j == SZ(pos[A[i]]) - 1)
				X[cnt - 1] = A[i + 1];
			  else {
				X[cnt - 1] = -(cnt + 1);
				cnt++;
			  }
			  Y[cnt - 1] = A[x + 1];
		  }
	  }
  }
  X.resize(cnt), Y.resize(cnt);
  answer(C, X, Y);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4940 KB Output is correct
2 Correct 36 ms 9616 KB Output is correct
3 Correct 39 ms 9216 KB Output is correct
4 Correct 4 ms 4940 KB Output is correct
5 Correct 15 ms 6364 KB Output is correct
6 Correct 54 ms 11444 KB Output is correct
7 Correct 4 ms 4940 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4940 KB Output is correct
2 Correct 36 ms 9616 KB Output is correct
3 Correct 39 ms 9216 KB Output is correct
4 Correct 4 ms 4940 KB Output is correct
5 Correct 15 ms 6364 KB Output is correct
6 Correct 54 ms 11444 KB Output is correct
7 Correct 4 ms 4940 KB Output is correct
8 Correct 62 ms 11784 KB Output is correct
9 Correct 71 ms 12556 KB Output is correct
10 Correct 121 ms 15456 KB Output is correct
11 Correct 4 ms 4940 KB Output is correct
12 Correct 4 ms 4940 KB Output is correct
13 Correct 5 ms 4940 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4940 KB Output is correct
2 Correct 36 ms 9616 KB Output is correct
3 Correct 39 ms 9216 KB Output is correct
4 Correct 4 ms 4940 KB Output is correct
5 Correct 15 ms 6364 KB Output is correct
6 Correct 54 ms 11444 KB Output is correct
7 Correct 4 ms 4940 KB Output is correct
8 Correct 62 ms 11784 KB Output is correct
9 Correct 71 ms 12556 KB Output is correct
10 Correct 121 ms 15456 KB Output is correct
11 Correct 4 ms 4940 KB Output is correct
12 Correct 4 ms 4940 KB Output is correct
13 Correct 5 ms 4940 KB Output is correct
14 Incorrect 91 ms 14348 KB wrong motion
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 4940 KB wrong motion
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 4940 KB wrong motion
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 4940 KB wrong motion
2 Halted 0 ms 0 KB -