Submission #771609

# Submission time Handle Problem Language Result Execution time Memory
771609 2023-07-03T07:20:03 Z ttamx Mechanical Doll (IOI18_doll) C++14
47 / 100
89 ms 11040 KB
#include "doll.h"
#include<bits/stdc++.h>
 
using namespace std;
 
void create_circuit(int m,vector<int> a) {
	int n = a.size();
	vector<int> c(m+1);
	vector<int> lg(n+1);
	for(int i=2;i<=n;i++)lg[i]=lg[i/2]+1;
	vector<int> x,y;
	auto add=[&](int u,int v){
		x.emplace_back(u);
		y.emplace_back(v);
		return -x.size();
	};
	a.push_back(0);
	int sz=n;
	int lv=lg[sz-1]+1;
	vector<int> res;
	int cnt=1<<(lv-1);
	int tar=-(x.size()+(1<<lv)-1);
	int st=(1<<lv)-sz+1;
	vector<int> pos(1<<lv);
	for(int j=0;j<1<<lv;j++){
		for(int k=0;k<lv;k++)if((j>>k)&1)pos[j]+=1<<(lv-k-1);
		pos[j]++;
	}
	for(int k=0;k<cnt;k++){
		int u=pos[k*2],v=pos[k*2+1];
		res.emplace_back(add(u<st?tar:a[u-st+1],v<st?tar:a[v-st+1]));
	}
	while(res.size()>1){
		vector<int> tmp;
		for(int i=0;i<res.size();i+=2)tmp.emplace_back(add(res[i],res[i+1]));
		res=tmp;
	}
	c[0]=a[0];
	for(int i=1;i<=m;i++)c[i]=tar;
	answer(c,x,y);
}

Compilation message

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:35:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |   for(int i=0;i<res.size();i+=2)tmp.emplace_back(add(res[i],res[i+1]));
      |               ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 296 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 300 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 212 KB Output is partially correct
2 Correct 35 ms 6072 KB Output is correct
3 Partially correct 63 ms 10308 KB Output is partially correct
4 Partially correct 83 ms 10796 KB Output is partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 212 KB Output is partially correct
2 Correct 35 ms 6072 KB Output is correct
3 Partially correct 63 ms 10308 KB Output is partially correct
4 Partially correct 83 ms 10796 KB Output is partially correct
5 Partially correct 76 ms 11040 KB Output is partially correct
6 Partially correct 72 ms 10928 KB Output is partially correct
7 Partially correct 71 ms 10928 KB Output is partially correct
8 Partially correct 89 ms 10932 KB Output is partially correct
9 Partially correct 66 ms 10244 KB Output is partially correct
10 Partially correct 70 ms 10876 KB Output is partially correct
11 Partially correct 70 ms 10848 KB Output is partially correct
12 Partially correct 64 ms 10316 KB Output is partially correct
13 Correct 47 ms 6684 KB Output is correct
14 Partially correct 65 ms 10392 KB Output is partially correct
15 Partially correct 66 ms 10444 KB Output is partially correct
16 Partially correct 2 ms 596 KB Output is partially correct
17 Correct 36 ms 6308 KB Output is correct
18 Correct 37 ms 6288 KB Output is correct
19 Partially correct 73 ms 10296 KB Output is partially correct
20 Partially correct 73 ms 10944 KB Output is partially correct
21 Partially correct 84 ms 10852 KB Output is partially correct
22 Partially correct 74 ms 10812 KB Output is partially correct