Submission #817025

# Submission time Handle Problem Language Result Execution time Memory
817025 2023-08-09T08:38:16 Z Trumling Comparing Plants (IOI20_plants) C++14
5 / 100
68 ms 8672 KB
#include "plants.h"
#include <bits/stdc++.h>
using namespace std; 

typedef long long ll;
#define pb push_back
#define F first
#define S second
#define enter cout<<'\n';
#define INF 99999999999999999
#define MOD 1000000007
#define all(x) x.begin(),x.end()
vector<int>pre,suf;
ll nn;
void init(int k, vector<int> r) {
	pre.assign(r.size(),0);
	suf.assign(r.size(),0);
	nn=r.size();

	for(int i=0;i<nn;i++)
		pre[i]=((i==0)?0:pre[i-1])+r[i];

	for(int i=nn-1;i>=0;i--)
		suf[i]=((i==nn-1)?0:suf[i+1])+r[i];

	return;
}
int compare_plants(int x, int y) 
{
	ll r=pre[y-1]-((x==0)?0:pre[x-1]);
	ll l= ((x==0)?0:pre[x-1])+ suf[y];
	ll ans=0;
	if(r==y-x)
		ans=-1;
	if(r==0)
		ans=1;
	if(l==nn-y+x)
		ans=1;
	if(l==0)
		ans=-1;

	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 45 ms 4040 KB Output is correct
7 Correct 52 ms 5548 KB Output is correct
8 Correct 54 ms 8600 KB Output is correct
9 Correct 68 ms 8636 KB Output is correct
10 Correct 60 ms 8652 KB Output is correct
11 Correct 59 ms 8660 KB Output is correct
12 Correct 57 ms 8672 KB Output is correct
13 Correct 54 ms 8640 KB Output is correct
14 Correct 58 ms 8664 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 292 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 45 ms 4040 KB Output is correct
7 Correct 52 ms 5548 KB Output is correct
8 Correct 54 ms 8600 KB Output is correct
9 Correct 68 ms 8636 KB Output is correct
10 Correct 60 ms 8652 KB Output is correct
11 Correct 59 ms 8660 KB Output is correct
12 Correct 57 ms 8672 KB Output is correct
13 Correct 54 ms 8640 KB Output is correct
14 Correct 58 ms 8664 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Incorrect 0 ms 212 KB Output isn't correct
18 Halted 0 ms 0 KB -