Submission #1040833

#TimeUsernameProblemLanguageResultExecution timeMemory
1040833nightfalComparing Plants (IOI20_plants)C++14
5 / 100
50 ms8800 KiB
#include "plants.h" static std:: vector<int> inc,dec; void init(int k, std::vector<int> r) { int n = r.size(); if(k==2) { inc.resize(n); dec.resize(n); for(int i=0; i<n; i++) {inc[i] = dec[i] = i;} int s,incVal,decVal; for(s=2*n-1; s>=0; s--) { if (r[s%n]==0) incVal = s; else decVal = s; inc[s%n] = incVal; dec[s%n] = decVal; } } return; } int subtask1(int x, int y) { int n = inc.size(); if (y <= dec[x] or x+n <= inc[y]) return 1; else if (y <= inc[x] or x+n <= dec[y]) return -1; return 0; } int compare_plants(int x, int y) { return subtask1(x,y); return 0; }

Compilation message (stderr)

plants.cpp: In function 'void init(int, std::vector<int>)':
plants.cpp:13:37: warning: 'decVal' may be used uninitialized in this function [-Wmaybe-uninitialized]
   13 |         inc[s%n] = incVal; dec[s%n] = decVal;
plants.cpp:13:18: warning: 'incVal' may be used uninitialized in this function [-Wmaybe-uninitialized]
   13 |         inc[s%n] = incVal; dec[s%n] = decVal;
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...