Submission #303345

# Submission time Handle Problem Language Result Execution time Memory
303345 2020-09-20T08:42:58 Z Utaha Comparing Plants (IOI20_plants) C++14
14 / 100
4000 ms 5240 KB
#include "plants.h"
#include<bits/stdc++.h>
using namespace std;
const int maxn = 200005;
#define REP(i,n) for(int i=0;i<(n);i++)
#define eb emplace_back
#define pb push_back
#define SZ(a) ((int)a.size())
#define ALL(a) a.begin(),a.end()
int n,k;

bool vis[maxn];

int a[maxn];

void init(int _k, std::vector<int> r) {
	n = r.size();
	k = _k;
	assert(k*2>n);
	int pt = 0;
	int cnt = 0;
	while(cnt<n){
		vector<int> idx;
		REP(j,n) if(!vis[j]){
			if(r[j]==0) idx.pb(j);
		}
		// for(int i:idx){
			// cout<<i<<' ';
		// }
		// cout<<endl;

		idx.pb(idx[0]+n);
		REP(i,SZ(idx)-1){
			if(idx[i+1]-idx[i]>=k){
				int t = idx[i+1]%n;
				vis[t] = 1;
				cnt++;
				a[t] = pt;
				REP(j,k-1){
					int pre = (t-j-1+n)%n;
					if(!vis[pre]) r[pre]--;
				}
			}
		}
		pt--;
		// for(int i:idx) cout<<i<<' ';
		// cout<<'\n';
		
	}
	// REP(i,n) cout<<a[i]<<" \n"[i==n-1];
	return;
}


int compare_plants(int x, int y) {
	if(a[x]>a[y]) return 1;
	else if(a[y]>a[x]) return -1;
	else return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Runtime error 1 ms 512 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 12 ms 384 KB Output is correct
7 Correct 314 ms 3320 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 13 ms 512 KB Output is correct
10 Correct 296 ms 3320 KB Output is correct
11 Correct 185 ms 3192 KB Output is correct
12 Correct 179 ms 3432 KB Output is correct
13 Correct 358 ms 3312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 12 ms 384 KB Output is correct
7 Correct 314 ms 3320 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 13 ms 512 KB Output is correct
10 Correct 296 ms 3320 KB Output is correct
11 Correct 185 ms 3192 KB Output is correct
12 Correct 179 ms 3432 KB Output is correct
13 Correct 358 ms 3312 KB Output is correct
14 Correct 3190 ms 3588 KB Output is correct
15 Execution timed out 4065 ms 5240 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Runtime error 1 ms 512 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Runtime error 1 ms 512 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Runtime error 1 ms 512 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -