Submission #768408

# Submission time Handle Problem Language Result Execution time Memory
768408 2023-06-28T05:43:18 Z ono_de206 Mechanical Doll (IOI18_doll) C++14
0 / 100
1 ms 212 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) {
	int n = a.size();
	a.pb(0);
	vector<int> C(m + 1, 0), X, Y;

	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.resize(m + 1, solve(a));
	answer(C, X, Y);
}

Compilation message

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:22:6: warning: unused variable 'n' [-Wunused-variable]
   22 |  int n = a.size();
      |      ^
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB wrong motion
2 Halted 0 ms 0 KB -