Submission #909908

#TimeUsernameProblemLanguageResultExecution timeMemory
909908PlayVoltzCoreputer (IOI23_coreputer)C++17
50 / 100
1 ms596 KiB
#include "coreputer.h" #include <bits/stdc++.h> using namespace std; #define pb push_back vector<int> malfunctioning_cores(int n){ vector<int> c(n, 0), vect; int low=-1, high=n, end; while (low+1<high){ int mid=(low+high)/2; vect.clear(); for (int i=0; i<=mid; ++i)vect.pb(i); int res=run_diagnostic(vect); if (res>=0)high=mid, end=res; else low=mid; } c[high]=1; if (high==n-1)return c; for (int i=0; i<high; ++i){ vect.clear(); for (int j=0; j<=high; ++j)if (i!=j)vect.pb(j); if (run_diagnostic(vect)<0)c[i]=1; } if (end){ for (int i=high+2; i<n; ++i){ vect.clear(); for (int j=high; j<n; ++j)if (i!=j)vect.pb(j); if (run_diagnostic(vect)<0)c[i]=1; } } else{ for (int i=high+1; i<n; ++i){ vect.clear(); for (int j=high+1; j<n; ++j)if (i!=j)vect.pb(j); if (run_diagnostic(vect)<0)c[i]=1; } } return c; }

Compilation message (stderr)

coreputer.cpp: In function 'std::vector<int> malfunctioning_cores(int)':
coreputer.cpp:25:2: warning: 'end' may be used uninitialized in this function [-Wmaybe-uninitialized]
   25 |  if (end){
      |  ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...