# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
400223 | faresbasbs | Comparing Plants (IOI20_plants) | C++14 | 69 ms | 4960 KiB |
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 "plants.h"
using namespace std;
bool seen[5001];
int val[5001];
void init(int k , vector<int> r){
int n = r.size() , cnt = 0;;
for(int i = 0 ; i < n ; i += 1){
int pos;
for(int j = 0 ; j < n ; j += 1){
if(seen[j] || r[j]){
continue;
}
pos = j;
}
for(int j = 1 ; j < k ; j += 1){
if(seen[(pos-j+n)%n] || r[(pos-j+n)%n]){
continue;
}
pos = (pos-j+n)%n;
break;
}
val[pos] = cnt++;
seen[pos] = 1;
for(int j = 1 ; j < k ; j += 1){
if(seen[(pos-j+n)%n]){
continue;
}
r[(pos-j+n)%n] -= 1;
}
}
}
int compare_plants(int x, int y){
if(val[x] < val[y]){
return 1;
}
return -1;
}
Compilation message (stderr)
# | 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... |