Submission #6110

# Submission time Handle Problem Language Result Execution time Memory
6110 2014-06-19T20:49:00 Z kriii 즐거운 채소 기르기 (JOI14_growing) C++
45 / 100
1000 ms 4720 KB
#include <stdio.h>
#include <stack>
using namespace std;

int N,D[300030],L[300030],R[300030];
stack<pair<int, int> > S; int lf;

int main()
{
	scanf ("%d",&N);
	for (int i=0;i<N;i++) scanf ("%d",&D[i]);
	for (int i=0;i<N;i++){
		for (int j=0;j<i;j++) if (D[i] < D[j]) L[i]++;
	}

	for (int i=N-1;i>=0;i--){
		for (int j=i+1;j<N;j++) if (D[i] < D[j]) R[i]++;
	}

	long long ans = 0;
	for (int i=0;i<N;i++) ans += L[i] < R[i] ? L[i] : R[i];

	printf ("%lld\n",ans);

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 4720 KB Output is correct
2 Correct 0 ms 4720 KB Output is correct
3 Correct 0 ms 4720 KB Output is correct
4 Correct 0 ms 4720 KB Output is correct
5 Correct 0 ms 4720 KB Output is correct
6 Correct 0 ms 4720 KB Output is correct
7 Correct 0 ms 4720 KB Output is correct
8 Correct 0 ms 4720 KB Output is correct
9 Correct 0 ms 4720 KB Output is correct
10 Correct 0 ms 4720 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 4720 KB Output is correct
2 Correct 0 ms 4720 KB Output is correct
3 Correct 0 ms 4720 KB Output is correct
4 Correct 0 ms 4720 KB Output is correct
5 Correct 0 ms 4720 KB Output is correct
6 Correct 0 ms 4720 KB Output is correct
7 Correct 0 ms 4720 KB Output is correct
8 Correct 0 ms 4720 KB Output is correct
9 Correct 0 ms 4720 KB Output is correct
10 Correct 0 ms 4720 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 4720 KB Output is correct
2 Correct 4 ms 4720 KB Output is correct
3 Correct 16 ms 4720 KB Output is correct
4 Correct 48 ms 4720 KB Output is correct
5 Correct 48 ms 4720 KB Output is correct
6 Correct 72 ms 4720 KB Output is correct
7 Correct 28 ms 4720 KB Output is correct
8 Correct 64 ms 4720 KB Output is correct
9 Correct 108 ms 4720 KB Output is correct
10 Correct 48 ms 4720 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 4716 KB Program timed out
2 Halted 0 ms 0 KB -