• + 0 comments

    Main function given in the code does not work properly. I shared the fixed C++ code below. Removed the part reading the p_count_temp, which does not exist in the input.

    int main()
    {
        ofstream fout(getenv("OUTPUT_PATH"));
    
        string g_temp;
        getline(cin, g_temp);
    
        int g = stoi(ltrim(rtrim(g_temp)));
    
        for (int g_itr = 0; g_itr < g; g_itr++) {
            
            string n_temp;
            getline(cin, n_temp);
            int n = stoi(ltrim(rtrim(n_temp)));
    
            string p_temp_temp;
            getline(cin, p_temp_temp);
            cout << p_temp_temp << endl;
    
            vector<string> p_temp = split(rtrim(p_temp_temp));
    
            vector<int> p;
            for (int i = 0; i < p_temp.size(); i++) {
                int p_item = stoi(p_temp[i]);
                p.push_back(p_item);
            }
    
            char result = zeroMoveNim(p);
            fout << result << "\n";
        }
    
        fout.close();
    
        return 0;
    }