Submission #800672

#TimeUsernameProblemLanguageResultExecution timeMemory
800672rubdary식물 비교 (IOI20_plants)C++14
0 / 100
4075 ms212 KiB
#include "plants.h" using namespace std; vector <bool> plants; void init(int k, vector<int> r) { for(int i = 0; i < r.size(); i++){ if(r[i] == 0) plants.push_back(true); else plants.push_back(false); } return; } int compare_plants(int x, int y) { int i = x; bool s = plants[x]; bool res = true; while(i != y){ if(i == plants.size()) i = 0; if(plants[i] != s) res = false; i++; } if(res == true && s == true) return 1; if(res == true && s == false) return -1; res = true; i = y; s = plants[y]; while(i != x){ if(i == plants.size()) i = 0; if(plants[i] != s) res = false; i++; } if(res == true && s == true) return 1; if(res == true && s == false) return -1; return 0; }

Compilation message (stderr)

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