답안 #768413

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
768413 2023-06-28T05:53:31 Z ono_de206 자동 인형 (IOI18_doll) C++14
37 / 100
447 ms 12660 KB
#include "doll.h"
#include<bits/stdc++.h>
using namespace std;

#define in insert
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second

// #define int long long
 
typedef long long ll;
typedef vector<int> vi;
typedef set<int> si;
typedef multiset<int> msi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

void create_circuit(int m, std::vector<int> a) {
	a.pb(0);
	int n = a.size();
	vector<int> C(m + 1, 0), X, Y;
	const int inf = 1e9 + 10;
	reverse(all(a));
	while(n & (n - 1)) {
		a.pb(inf);
		n++;
	}
	reverse(all(a));
	// for(int i = 0; i < n; i++) {
	// 	cout << a[i] << ' ';
	// }
	// cout << '\n';
	function<int(vector<int>&)> solve = [&](vector<int>& vec) {
		if(set<int>(all(vec)).size() == 1) return vec[0];
		if(vec.size() == 2) {
			X.pb(vec[0]);
			Y.pb(vec[1]);
		} else {
			vector<int> first, second;
			for(int i = 0; i < (int)vec.size(); i += 2) {
				first.pb(vec[i]);
				second.pb(vec[i + 1]);
			}
			int id1 = solve(first), id2 = solve(second);
			X.pb(id1);
			Y.pb(id2);
		}
		return -(int)X.size();
	};
	C[0] = solve(a);
	for(int i = 1; i < C.size(); i++) {
		C[i] = C[0];
	}
	for(int i = 0; i < X.size(); i++) {
		if(X[i] == inf) X[i] = C[0];
		if(Y[i] == inf) Y[i] = C[0];
		// cout << X[i] << ' ' << Y[i] << '\n';
	}
	// for(int i = 0; i < C.size(); i++) {
	// 	cout << C[i] << ' ';
	// }
	// cout << '\n';
	answer(C, X, Y);
}

Compilation message

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:54:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |  for(int i = 1; i < C.size(); i++) {
      |                 ~~^~~~~~~~~~
doll.cpp:57:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |  for(int i = 0; i < X.size(); i++) {
      |                 ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 212 KB Output is partially correct
2 Partially correct 107 ms 10824 KB Output is partially correct
3 Partially correct 110 ms 10860 KB Output is partially correct
4 Correct 99 ms 9260 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 212 KB Output is partially correct
2 Partially correct 107 ms 10824 KB Output is partially correct
3 Partially correct 110 ms 10860 KB Output is partially correct
4 Correct 99 ms 9260 KB Output is correct
5 Partially correct 447 ms 12528 KB Output is partially correct
6 Partially correct 379 ms 12660 KB Output is partially correct
7 Partially correct 388 ms 11268 KB Output is partially correct
8 Partially correct 360 ms 11888 KB Output is partially correct
9 Partially correct 123 ms 10756 KB Output is partially correct
10 Partially correct 249 ms 9944 KB Output is partially correct
11 Partially correct 270 ms 10752 KB Output is partially correct
12 Partially correct 205 ms 10564 KB Output is partially correct
13 Partially correct 268 ms 10832 KB Output is partially correct
14 Partially correct 280 ms 12184 KB Output is partially correct
15 Partially correct 283 ms 11208 KB Output is partially correct
16 Partially correct 5 ms 596 KB Output is partially correct
17 Correct 161 ms 7180 KB Output is correct
18 Partially correct 197 ms 9740 KB Output is partially correct
19 Partially correct 212 ms 11144 KB Output is partially correct
20 Partially correct 316 ms 11580 KB Output is partially correct
21 Partially correct 257 ms 11608 KB Output is partially correct
22 Partially correct 297 ms 11468 KB Output is partially correct