Submission #833918

#TimeUsernameProblemLanguageResultExecution timeMemory
833918finn__Comparing Plants (IOI20_plants)C++17
5 / 100
74 ms7920 KiB
#include <bits/stdc++.h> #include "plants.h" using namespace std; constexpr size_t N = 200000; size_t n; int subtask, s[N]; void init(int k, std::vector<int> r) { n = r.size(); if (k == 2) subtask = 1; else subtask = 3; if (subtask == 1) { partial_sum(r.begin(), r.end(), s); } else { } } int compare_plants(int x, int y) { if (subtask == 1) { int z = s[y - 1] - (x ? s[x - 1] : 0); return !z ? 1 : (z == y - x ? -1 : (!(s[n - 1] - z) ? -1 : ((s[n - 1] - z == n - (y - x) ? 1 : 0)))); } }

Compilation message (stderr)

plants.cpp: In function 'int compare_plants(int, int)':
plants.cpp:34:83: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'long unsigned int'} [-Wsign-compare]
   34 |         return !z ? 1 : (z == y - x ? -1 : (!(s[n - 1] - z) ? -1 : ((s[n - 1] - z == n - (y - x) ? 1 : 0))));
      |                                                                      ~~~~~~~~~~~~~^~~~~~~~~~~~~~
plants.cpp:36:1: warning: control reaches end of non-void function [-Wreturn-type]
   36 | }
      | ^
#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...