제출 #427683

#제출 시각아이디문제언어결과실행 시간메모리
427683lakshith_식물 비교 (IOI20_plants)C++14
0 / 100
4081 ms7876 KiB
#include "plants.h" #include <bits/stdc++.h> using namespace std; #define what_is(a) cout << #a << " is " << a << "\n" vector<int> r; int n; void init(int k, std::vector<int> R) { assert(k==2); r=R; n = R.size(); return; } int compare_plants(int x, int y) { int b = 1; if(x>y){ swap(x,y); b=-1; } int one=0,zero=0; int p=x; for(int i=0;i<abs(x-y);i++){ if(r[p]==1)one++; else zero++; p++; if(p==n)p=0; } //what_is(one); //what_is(zero); if(zero==0)return -1*b; else if(one==0)return 1*b; p=y,one=0,zero=0; for(int i=0;i<n-y+x;i++){ if(r[p]==1)one++; else zero++; p++; if(p==n)p=0; } //what_is(one); //what_is(zero); if(zero==0)return 1*b; else if(one==0)return -1*b; return 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...