Submission #15178586


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
int main()
{
    #ifdef TarekHasan
        //freopen("input.txt","r",stdin);
    #endif // TarekHasan
    long long int n; cin >> n;
    string str; cin >> str;
    for(long long int i=0;i<(long long int)str.size();i++)
    {
        string temp = str;
        temp[i] = str[i]=='0' ? '1' : '0';
        long long int x = stoi(temp,0,2);

        bitset< 200002 > bits(x);
        long long int counter = 1;

        while(stoi(bits.to_string(),0,2)%bits.count())
        {
            counter++;
            bitset < 200002 > t(stoi(bits.to_string(),0,2)%bits.count());
            bits=t;
        }
        cout << counter << endl;
    }

    return 0;
}

Submission Info

Submission Time
Task D - Anything Goes to Zero
User TarekHasan
Language C++ (GCC 9.2.1)
Score 0
Code Size 731 Byte
Status RE
Exec Time 112 ms
Memory 4152 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 2
AC × 3
RE × 18
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
hand_01.txt AC 7 ms 3644 KiB
hand_02.txt RE 112 ms 3628 KiB
hand_03.txt RE 108 ms 3740 KiB
hand_04.txt RE 108 ms 3528 KiB
hand_05.txt RE 111 ms 4152 KiB
hand_06.txt RE 111 ms 4060 KiB
hand_07.txt RE 109 ms 4036 KiB
random_01.txt RE 112 ms 4036 KiB
random_02.txt RE 109 ms 4040 KiB
random_03.txt RE 111 ms 4036 KiB
random_04.txt RE 109 ms 3992 KiB
random_05.txt RE 111 ms 3972 KiB
random_06.txt RE 106 ms 3492 KiB
random_07.txt RE 107 ms 3884 KiB
random_08.txt RE 108 ms 3716 KiB
random_09.txt RE 111 ms 4064 KiB
random_10.txt RE 108 ms 3776 KiB
random_11.txt RE 108 ms 4060 KiB
random_12.txt RE 109 ms 3796 KiB
sample_01.txt AC 10 ms 3872 KiB
sample_02.txt AC 56 ms 3856 KiB