Submission #1036306

# Submission time Handle Problem Language Result Execution time Memory
1036306 2024-07-27T08:33:08 Z Dan4Life Comparing Plants (IOI20_plants) C++17
14 / 100
594 ms 11604 KB
#include "plants.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) begin(a), end(a)
using ar2 = array<int,2>;
const int mxN = (int)5e3+10;
int n, comp[mxN], COMP;
vector<int> adj[mxN];
int deg[mxN], ord[mxN];
int h[mxN];

void init(int k, vector<int> r) {
	n = sz(r); k--; int xd = n;
	while(1){
		bool ok = 0;
		for(int i = 0; i < n; i++){
			if(r[i]!=0) continue;
			bool bad = 0;
			{
				int tot = k, j = i;
				while(tot-- and !bad){
					j--; if(j==-1) j=n-1;
					if(r[j]==0) bad=1;
				}
			}
			if(bad) continue;
			{
				int tot = k, j = i;
				while(tot-- and !bad){
					j--; if(j==-1) j=n-1;
					r[j]--;
				}
			}
			h[i]=xd; xd--; r[i]--; ok=1;
		}
		if(!ok) break;
	}
}

int compare_plants(int x, int y) {
	if(!h[x] or !h[y]) return 0;
	return h[x]>h[y]?1:-1;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 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 344 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 0 ms 348 KB Output is correct
6 Correct 3 ms 604 KB Output is correct
7 Correct 83 ms 5204 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 3 ms 604 KB Output is correct
10 Correct 75 ms 5204 KB Output is correct
11 Correct 55 ms 5204 KB Output is correct
12 Correct 70 ms 5380 KB Output is correct
13 Correct 83 ms 5116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 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 0 ms 348 KB Output is correct
6 Correct 3 ms 604 KB Output is correct
7 Correct 83 ms 5204 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 3 ms 604 KB Output is correct
10 Correct 75 ms 5204 KB Output is correct
11 Correct 55 ms 5204 KB Output is correct
12 Correct 70 ms 5380 KB Output is correct
13 Correct 83 ms 5116 KB Output is correct
14 Runtime error 594 ms 5604 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 33 ms 4948 KB Output is correct
4 Runtime error 43 ms 11604 KB Execution killed with signal 11
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 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 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -