Submission #1078166

#TimeUsernameProblemLanguageResultExecution timeMemory
1078166mindiyakComparing Plants (IOI20_plants)C++14
0 / 100
1 ms600 KiB
#include "plants.h" #include <iostream> using namespace std; #define F first #define S second vector<pair<int,int>> R; vector<int> pos; vector<int> m; int N; void init(int k, std::vector<int> r) { int start = 0; int len = 1; pos.push_back(R.size()); N = r.size(); for(int l=1;l<r.size()*2;l++){ int i = l%r.size(); if(r[i] == r[start]){ len ++; }else{ R.push_back({start,len}); start = i; len = 1; } pos.push_back(R.size()); } m = r; return; } int compare_plants(int x, int y) { int a=x; // cerr << x << " " << y << endl; a = pos[x]; if(m[R[a].F] == 0){ if(R[a].S == (y-x)) return 1; } a = pos[y]; if(m[R[a].F] == 1){ if(R[a].S == (N-y+x)) return 1; } a = pos[x]; if(m[R[a].F] == 1){ if(R[a].S == (y-x)) return -1; } a = pos[y]; if(m[R[a].F] == 0){ if(R[a].S == (N-y+x)) return -1; } return 0; }

Compilation message (stderr)

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