QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#806900 | #9852. Divisions | rotcar07 | WA | 1ms | 3652kb | C++23 | 416b | 2024-12-09 16:42:09 | 2024-12-09 16:42:10 |
Judging History
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 3 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: 1ms
memory: 3588kb
input:
1
output:
6 1 1 4 5 1 4
result:
ok correct
Test #2:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
2
output:
1 1
result:
ok correct
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3616kb
input:
0
output:
8 1 2 3 3 1 3 3 7
result:
wrong answer wrong answer