Submission #346163

#TimeUsernameProblemLanguageResultExecution timeMemory
346163lLab_Counting Mushrooms (IOI20_mushrooms)C++14
25 / 100
145 ms512 KiB
#include "mushrooms.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> A = {0};

int count_mushrooms(int n) {
    int sum = 1;
    int i=1;
    while(i<n){
        vector<int> S;
        int p=1;
        int nA = A.size();
        int cnt = 0;
        for(int j=0;j<nA&&i<n;++j){
            S.push_back(A[j]);
            S.push_back(i);
            p = i;
            i++;
            cnt++;
        }
        int d = use_machine(S);
        sum += cnt-(d+1)/2;
        if(d == 0) A.push_back(i-1);
    }
    return sum;
}

Compilation message (stderr)

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:12:13: warning: variable 'p' set but not used [-Wunused-but-set-variable]
   12 |         int p=1;
      |             ^
#Verdict Execution timeMemoryGrader output
Fetching results...