제출 #603619

#제출 시각아이디문제언어결과실행 시간메모리
603619HamletPetrosyan식물 비교 (IOI20_plants)C++17
0 / 100
1 ms236 KiB
#include "plants.h" using namespace std; #define len(a) ((int)(a).size()) vector<int> p, m; void init(int k, vector<int> r) { p.resize(len(r)); m.resize(len(r)); for(int i = 0, pr, now; i < 2 * len(r); i++){ now = i % len(r); pr = (now == 0) ? len(r) - 1 : now - 1; p[now] = m[now] = now; if(r[pr] == 0){ p[now] = p[pr]; } else { m[now] = m[pr]; } } // for(int i = 0; i < len(p); i++){ // cout << p[i] << " "; // } // cout << endl; // for(int i = 0; i < len(m); i++){ // cout << m[i] << " "; // } // cout << endl; } int compare_plants(int x, int y) { if(x < y){ if(p[x] > x && p[x] <= y) return -1; if(m[x] > x && m[x] <= y) return 1; return 0; } if(p[x] <= y || p[x] > x) return -1; if(m[x] <= y || m[x] > 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...