Submission #1032974

#TimeUsernameProblemLanguageResultExecution timeMemory
1032974fv3Comparing Plants (IOI20_plants)C++14
0 / 100
0 ms348 KiB
#include "plants.h" #include <bits/stdc++.h> using namespace std; vector<int> R; vector<int> pre; int K, N; void init(int k, vector<int> r) { N = r.size(); R = r; k = K; pre.resize(N); int s = 0; for (; s < N; s++) { if (r[s] == 0) break; } for (int i = s; i < N; i++) { if (r[i]) pre[i] = pre[i-1] + 1; } if (r[0]) { pre[0] = pre[N-1] + 1; for (int i = 1; i < s; i++) pre[i] = pre[i-1] + 1; } for (int i = 0; i < N; i++) { pre.push_back(pre[i]); } } int compare_plants(int x, int y) { if (y - pre[y] <= x) return -1; if (x + N - pre[x+N] <= y) 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...