This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#include<unordered_map>
#include "plants.h"
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
#define rrep(i,a,b) for(int i=int(a);i>int(b);i--)
#define all(v) v.begin(),v.end()
#define trav(a,v) for(auto&a:v)
#define sz(a) a.size()
typedef long double ld;
using namespace std;
static const long long inf = 1e15;
static const long long infint = 1e9;
typedef long long ll;
typedef unsigned long long ull;
vector<ll> sorted;
void init(int k, std::vector<int> r) {
ll n = r.size();
rep(i, 0, n) {
ll indx = 0;
rrep(j,n-1,-1){
if (r[j] == 0) {
indx = j;
break;
}
}
ll cur = 0;
rep(j, 0, n) {
cur++;
if (r[(indx + j) % n] == 0) {
if (cur > k) {
indx = (j + indx) % n;
break;
}
else cur = 1;
}
}
r[indx] = infint;
sorted.push_back(indx);
indx -= (k-1);
indx += n;
rep(j, 0, k) {
r[(indx + j) % n] -= 1;
}
}
reverse(all(sorted));
}
int compare_plants(int x, int y) {
if (find(all(sorted), x) - find(all(sorted), y) > 0)return 1;
return -1;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |