이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |