Submission #711740

# Submission time Handle Problem Language Result Execution time Memory
711740 2023-03-17T11:54:09 Z pcc Popcount (COCI19_popcount) C++14
0 / 110
1 ms 296 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
    // ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n,k;
    cin>>n>>k;
    // cout<<"1\nA=((((1<<3)>>3)+(1<<2))+(1<<2))";return 0;
    cout<<(n+3)/4<<'\n';
    // A=((((((A&(1<<0))>>0)+((A&(1<<1))>>1))+((A&(1<<2))>>2))+((A&(1<<3))>>3))+((A>>4)<<4))
    for(int i = 0;i<n;i+=4){
        printf("A=((((((A&(1<<%d))>>%d)+((A&(1<<%d))>>%d))+((A&(1<<%d))>>%d))+((A&(1<<%d))>>%d))+((A>>%d)<<%d))\n",i,i,i+1,i+1,i+2,i+2,i+3,i+3,i+4,i+4);
        // A=((((((A&(1<<%d))>>%d)+((A&(1<<(%d)))>>(%d)))+((A&(1<<(%d)))>>(%d)))+((A&(1<<(%d)))>>(%d)))+((A>>(%d))<<(%d)))
        // cout<<"A=(((A&(1<<"<<i<<"))>>"<<i<<")+(A-(A&"<<"(1<<"<<i<<"))))\n";
        // A=(((A&(1<<0))>>0)+(A-(A&(1<<0))))

        // A=((((((A&(1<<0))>>0)+((A&(1<<(0+1)))>>(0+1)))+((A&(1<<(0+2)))>>(0+2)))+((A&(1<<(0+3)))>>(0+3)))+((A>>(0+4))<<(0+4)))
    }
    // for(int j = 0;j<(1<<n);j++){
    //     int A = j;
    //     for(int i = 1;i<n;i++){
    //         A=((A&(1<<i))>>i)+(A^(A&(1<<i)));
    //     }
    //     assert(A == __builtin_popcount(j));
    // }
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Wrong command format.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 296 KB Wrong answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Wrong command format.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Incorrect number of commands.
2 Halted 0 ms 0 KB -