Submission #302858

#TimeUsernameProblemLanguageResultExecution timeMemory
302858BasilhijazComparing Plants (IOI20_plants)C++17
5 / 100
115 ms12152 KiB
#include "plants.h" #include <bits/stdc++.h> using namespace std; vector<int> pre(2000005); int n; int cnt = 0; void init(int k, std::vector<int> r) { n = r.size(); for(int i = 0; i < n; i++){ pre[i + 1] = pre[i] + r[i]; cnt += r[i]; } return; } int compare_plants(int x, int y) { if(pre[y] - pre[x] == y - x){ return -1; } if(pre[y] - pre[x] == 0){ return 1; } if (cnt - (pre[y] - pre[x]) == n - (y - x)){ return 1; } else if (cnt - (pre[y] - pre[x]) == 0){ 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...