Submission #388020

#TimeUsernameProblemLanguageResultExecution timeMemory
388020SupersonicComparing Plants (IOI20_plants)C++17
5 / 100
758 ms11352 KiB
#include "plants.h" #include <bits/stdc++.h> using namespace std; int a[400001];int b[400001];int n; void init(int k, std::vector<int> r) { if(k==2){ n=r.size(); for(int i=0;i<n;i++)r.push_back(r[i]); for(int i=0;i<2*n;i++)b[i]=r[i]; a[0]=0; for(int i=1;i<2*n;i++){if(r[i]==r[i-1])a[i]=a[i-1];else a[i]=a[i-1]+1;} } return; } int compare_plants(int x, int y) { //cerr<<x<<' '<<y<<endl; if(x>y)y+=n;y--; if(a[x]==a[y]){ //cerr<<b.size()<<endl; if(b[x]==0)return 1; else return -1; } cerr<<x<<' '<<y<<endl; y++;y%=n;if(y>x)x+=n;x--; if(a[x]==a[y]){ //cerr<<b.size()<<endl; if(b[y]==0)return -1; else return 1; } return 0; }

Compilation message (stderr)

plants.cpp: In function 'int compare_plants(int, int)':
plants.cpp:18:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   18 |  if(x>y)y+=n;y--;
      |  ^~
plants.cpp:18:14: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   18 |  if(x>y)y+=n;y--;
      |              ^
#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...