Submission #1092404

#TimeUsernameProblemLanguageResultExecution timeMemory
1092404LuvidiCoreputer (IOI23_coreputer)C++17
60 / 100
1 ms596 KiB
#include "coreputer.h" #include <bits/stdc++.h> using namespace std; std::vector<int> malfunctioning_cores(int n) { int idx,s; vector<int> v; for(int i=0;i<n;i++){ v.push_back(i); int x=run_diagnostic(v); if(x!=-1){ s=x; idx=i; break; } } vector<int> ans(n); if(s){ v.pop_back(); for(int i=idx;i<n;i++){ v.push_back(i); ans[i]=run_diagnostic(v)==1; v.pop_back(); } v.clear(); for(int i=idx+1;i<n;i++)v.push_back(i); for(int i=0;i<idx;i++){ v.push_back(i); ans[i]=run_diagnostic(v)==1; v.pop_back(); } }else{ for(int i=idx+1;i<n;i++){ v.push_back(i); ans[i]=run_diagnostic(v)==1; v.pop_back(); } v.clear(); for(int i=idx+1;i<n;i++)v.push_back(i); for(int i=0;i<=idx;i++){ v.push_back(i); ans[i]=run_diagnostic(v)==1; v.pop_back(); } } return ans; }

Compilation message (stderr)

coreputer.cpp: In function 'std::vector<int> malfunctioning_cores(int)':
coreputer.cpp:40:16: warning: 'idx' may be used uninitialized in this function [-Wmaybe-uninitialized]
   40 |   for(int i=0;i<=idx;i++){
      |               ~^~~~~
coreputer.cpp:18:2: warning: 's' may be used uninitialized in this function [-Wmaybe-uninitialized]
   18 |  if(s){
      |  ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...