Submission #800281

# Submission time Handle Problem Language Result Execution time Memory
800281 2023-08-01T13:03:17 Z I_Love_EliskaM_ Comparing Plants (IOI20_plants) C++14
0 / 100
1 ms 212 KB
#include "plants.h"
#include <bits/stdc++.h>
using namespace std;
#define forn(i,_n) for(int i=0;i<_n;++i)
#define all(x) x.begin(),x.end()
#define pb push_back
#define pi pair<int,int>
#define f first
#define s second
using ll = long long;

const int N=2e5+55;
int p[N];
int n;
int k;
void init(int _k, vector<int> r) {
	k=_k;
	n=r.size();
	if (2*k<=n) exit(0);
	//if (n>5000) exit(0);
	vector<int> pos(k,-1);

	forn(i,n) {

		int z=0;
		forn(i,n) if (r[i]==k-1) z=i;
		int d=0;
		int j=z;
		while (d<k) {
			if (r[j]==k-1) {
				d=0, z=j;
			}
			++d;
			j=(j-1+n)%n;
		}
		p[i]=z;
		d=0;
		j=z;
		while (d<k) {
			r[j]++;
			++d;
			j=(j-1+n)%n;
		}

	}

}

int compare_plants(int x, int y) {

	if (p[x]>p[y]) return 1;
	else return -1;

}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -