This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int N, K;
/*
void subtask1(){
printf("%d\n",(N-1)/2);
for(int i = 1;i < N;i += 2){
printf("A=((A+(((A&(1<<%d))>>%d)-(A&(1<<%d))))+(((A&(1<<%d))>>%d)-(A&(1<<%d))))\n", i, i, i, i + 1, i + 1,i + 1);
}
}
* */
void subtask1(){
printf("%d\n",N-1);
for(int i = 1;i < N;i++){
printf("A=((A+((A&(1<<%d))>>%d))-(A&(1<<%d)))\n", i, i, i);
}
}
void subtask2(){
vector<string> ans;
printf("128\n");
bool mode = false;
for(int i = 1;i < 9;i += 2){
printf("A=((A+(((A&(1<<%d))>>%d)-(A&(1<<%d))))+(((A&(1<<%d))>>%d)-(A&(1<<%d))))\n", i, i, i, i + 1, i + 1,i + 1);
}
for(int i = 9;i < 501;i += 4){
printf("A=((((A+((A&(1<<%d))>>%d))+((A&(1<<%d))>>%d))+((A&(1<<%d))>>%d))+((A&(1<<%d))>>%d))\n", i,i,i+1,i+1,i+2,i+2,i+3,i+3);
}
printf("A=(A&511)");
}
//A=((A+(((A&(1<<%d))>>%d)))-((A&(1<<%d))))
int main(){
cin >> N >> K;
if(N == K + 1) subtask1();
else subtask2();
}
Compilation message (stderr)
popcount.cpp: In function 'void subtask2()':
popcount.cpp:24:7: warning: unused variable 'mode' [-Wunused-variable]
bool mode = false;
^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |