#include "plants.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
const ll NN = 3e5 + 5;
ll a[NN], n;
void init(int k, std::vector<int> r) {
n = r.size();
for(ll i = 0; i < n; i++)
{
ll idx = 0;
vector<ll> tmp;
for(ll j = 0; j < n; j++)
if(r[j] == 0)
tmp.pb(j);
if(tmp.size() == 1)
idx = tmp[0];
else
if(tmp.size() > 2)
while(1);
else
if(tmp[0] + k > tmp[1])
idx = tmp[0];
else
if(tmp[1] + k - n > tmp[0])
idx = tmp[1];
else
while(1);
a[idx] = n - i;
for(ll j = idx; j > (idx - k); j--)
r[(j + n) % n]--;
// cout << idx << " " << a[idx] << "\n";
// for(ll j = 0; j < n; j++)
// cout << r[j] << " ";
// cout << "\n";
}
// for(ll i = 0; i < n; i++)
// cout << a[i] - 1 << " ";
// cout << "\n";
return;
}
int compare_plants(int x, int y) {
if(a[x] > a[y])return 1;
else return -1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Execution timed out |
4049 ms |
256 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
360 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Execution timed out |
4070 ms |
384 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
360 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Execution timed out |
4070 ms |
384 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
4019 ms |
384 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Execution timed out |
4046 ms |
384 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Execution timed out |
4014 ms |
256 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Execution timed out |
4049 ms |
256 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |