Submission #1051431

# Submission time Handle Problem Language Result Execution time Memory
1051431 2024-08-10T06:43:06 Z pcc Comparing Plants (IOI20_plants) C++17
14 / 100
4000 ms 12788 KB
#include "plants.h"
#include <bits/stdc++.h>
using namespace std;

const int mxn = 4e5+10;
#define pii pair<int,int>
#define fs first
#define sc second
int arr[mxn];
int N;
int K;
int perm[mxn];
bitset<mxn> done;
int dp[mxn];

void calc(int id){
	fill(dp,dp+N*2,0);
	for(int i = 0;i<N*2;i++){
		if(i)dp[i] = (arr[i-1]?dp[i-1]:0);
		dp[i]++;
	}
	int tar = 0;
	for(int i = 0;i<N*2;i++){
		if(!arr[i]&&dp[i]>=K)tar = i%N;
	}
	perm[tar] = id;
	arr[tar] = arr[tar+N] = mxn;
	for(int i = 0;i<K;i++){
		int pre = (tar+N-i)%N;
		arr[pre]--;arr[pre+N]--;
	}
	return;
}

void init(int k, std::vector<int> r) {
	K = k;
	N = r.size();
	for(int i = 0;i<N;i++)arr[i] = arr[i+N] = r[i];
	for(int i = N-1;i>=0;i--)calc(i);
}

int compare_plants(int x, int y) {
	return (perm[x]>perm[y]?1:-1);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 0 ms 4444 KB Output is correct
3 Correct 0 ms 4444 KB Output is correct
4 Incorrect 0 ms 4444 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 0 ms 4444 KB Output is correct
3 Correct 0 ms 4444 KB Output is correct
4 Correct 0 ms 4444 KB Output is correct
5 Correct 0 ms 4444 KB Output is correct
6 Correct 5 ms 4444 KB Output is correct
7 Correct 119 ms 9140 KB Output is correct
8 Correct 2 ms 4440 KB Output is correct
9 Correct 6 ms 4444 KB Output is correct
10 Correct 131 ms 9120 KB Output is correct
11 Correct 109 ms 9040 KB Output is correct
12 Correct 103 ms 9300 KB Output is correct
13 Correct 142 ms 9296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 0 ms 4444 KB Output is correct
3 Correct 0 ms 4444 KB Output is correct
4 Correct 0 ms 4444 KB Output is correct
5 Correct 0 ms 4444 KB Output is correct
6 Correct 5 ms 4444 KB Output is correct
7 Correct 119 ms 9140 KB Output is correct
8 Correct 2 ms 4440 KB Output is correct
9 Correct 6 ms 4444 KB Output is correct
10 Correct 131 ms 9120 KB Output is correct
11 Correct 109 ms 9040 KB Output is correct
12 Correct 103 ms 9300 KB Output is correct
13 Correct 142 ms 9296 KB Output is correct
14 Correct 1286 ms 9808 KB Output is correct
15 Execution timed out 4067 ms 12788 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 4440 KB Output is correct
2 Correct 0 ms 4444 KB Output is correct
3 Correct 36 ms 7152 KB Output is correct
4 Execution timed out 4037 ms 11760 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 0 ms 4444 KB Output is correct
3 Incorrect 0 ms 4444 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 0 ms 4444 KB Output is correct
3 Incorrect 0 ms 4444 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 0 ms 4444 KB Output is correct
3 Correct 0 ms 4444 KB Output is correct
4 Incorrect 0 ms 4444 KB Output isn't correct
5 Halted 0 ms 0 KB -