QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#806901#9852. Divisionsrotcar07WA 0ms3768kbC++23416b2024-12-09 16:42:372024-12-09 16:42:38

Judging History

你现在查看的是最新测评结果

  • [2024-12-09 16:42:38]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3768kb
  • [2024-12-09 16:42:37]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
constexpr int N=2e5+5;
int main(){
	int x;cin>>x;
	if(x==0) cout<<"8\n1 2 3 3 1 4 3 7\n";else
	if(x==1) cout<<"6\n1 1 4 5 1 4\n";
	else{
		vector<int> v;
		int c=0;
		while(x>1){
			c++;
			for(int i=1;i<=__lg(x);i++) v.push_back(c);
			x-=1<<__lg(x)-1;
		}
		cout<<v.size()<<'\n';reverse(v.begin(),v.end());
		for(int x:v) cout<<x<<' ';cout<<'\n';
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3616kb

input:

1

output:

6
1 1 4 5 1 4

result:

ok correct

Test #2:

score: 0
Accepted
time: 0ms
memory: 3500kb

input:

2

output:

1
1 

result:

ok correct

Test #3:

score: 0
Accepted
time: 0ms
memory: 3560kb

input:

0

output:

8
1 2 3 3 1 4 3 7

result:

ok correct

Test #4:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

3

output:

2
2 1 

result:

ok correct

Test #5:

score: -100
Wrong Answer
time: 0ms
memory: 3768kb

input:

4

output:

3
2 1 1 

result:

wrong answer wrong answer