제출 #395034

#제출 시각아이디문제언어결과실행 시간메모리
395034snasibov05식물 비교 (IOI20_plants)C++14
0 / 100
61 ms3192 KiB
#include "plants.h" #define pb push_back using namespace std; vector<int> h; void init(int k, vector<int> r) { int n = r.size(); h.resize(n); vector<int> v[k]; for (int i = 0; i < n; ++i) { v[r[i]].pb(i); } int cur_h = 1; for (int i = k-1; i >= 0; --i) { int x = v[i].size(); for (int j = 0; j < x; ++j) { v[i].pb(v[i][j] + n); } int l = 0; for (int j = 0; j < x; ++j) { auto it = lower_bound(v[i].begin() , v[i].end(), v[i][j]+1); if (*it > j + k - 1) l = j+1; } for (int j = l%x; j < l%x + x; ++j) { h[v[i][j]%n] = cur_h++; } } } int compare_plants(int x, int y) { if (h[x] > h[y]) return 1; else return -1; }
#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...