Submission #1056070

# Submission time Handle Problem Language Result Execution time Memory
1056070 2024-08-13T07:35:39 Z LittleOrange Comparing Plants (IOI20_plants) C++17
0 / 100
1028 ms 7624 KB
#include "plants.h"
#include<bits/stdc++.h>
using namespace std;
using ll = int;
vector<ll> r,rk;
ll n,k;

void init(int K, std::vector<int> R) {
	n = R.size();
	k = K;
	r = R;
	rk.resize(n,-1);
	vector<ll> a = R;
	for(ll t = 0;t<n;t++){
		vector<ll> zs;
		for(ll i = 0;i<n;i++) if(rk[i]==-1&&a[i]<=0) zs.push_back(i);
		ll zz = zs[0];
		if(zs.size()>1){
			if ((zs[0]-zs[1]+n)%n<=k-1)zz = zs[1];
		}
		rk[zz] = t;
		for(ll i = 1;i<k;i++) a[(zz-i+n)%n]--;
	}
}

int compare_plants(int x, int y) {
	cerr << rk.size() << " " << x << " " << y << endl;
	if (rk[x]<rk[y]) return 1;
	else return -1;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 604 KB Output is correct
3 Correct 0 ms 436 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
6 Incorrect 27 ms 600 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
6 Incorrect 27 ms 600 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 436 KB Output is correct
3 Incorrect 1028 ms 7624 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 432 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 604 KB Output is correct
3 Correct 0 ms 436 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -