제출 #438572

#제출 시각아이디문제언어결과실행 시간메모리
438572AmineTrabelsi식물 비교 (IOI20_plants)C++14
0 / 100
1 ms204 KiB
#include "plants.h" #include <bits/stdc++.h> using namespace std; const int M = 200005; int pref[M]; int n; int sum(int l,int r){ if(r < l){ return sum(0,r)+sum(l,n-1); } return pref[r+1]-pref[l]; } void init(int k, vector<int> r) { n = r.size(); for(int i=0;i<n;i++){ pref[i+1] = pref[i]+r[i]; } return; } bool istaller(int x,int y){ if(x > y && sum(x,(y > 0 ? y-1 : n-1)) == 0)return true; int range = sum(0,n-1)-sum(x,y); if(x< y && range == n-abs(x-y)-1)return true; return false; } int compare_plants(int x, int y) { if(istaller(x,y))return 1; if(istaller(y,x))return -1; 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...