Submission #421297

#TimeUsernameProblemLanguageResultExecution timeMemory
421297JUANDI321Comparing Plants (IOI20_plants)C++17
0 / 100
1 ms204 KiB
#include "plants.h" #include <vector> #include <iostream> using namespace std; int sumpf[200010]; void init(int k, vector<int> r) { sumpf[0] = 200010; for(int i = 1; i<r.size(); i++) { sumpf[i]=sumpf[i-1]+r[i]; if(r[i]==0)sumpf[i]--; } return; } int compare_plants(int x, int y) { int dis = y-x+1; if(sumpf[y]-sumpf[x-1] == dis)return 1; if(sumpf[y]-sumpf[x-1] == -1*dis)return -1; return 0; }

Compilation message (stderr)

plants.cpp: In function 'void init(int, std::vector<int>)':
plants.cpp:10:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |  for(int i = 1; i<r.size(); i++)
      |                 ~^~~~~~~~~
#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...