답안 #112580

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
112580 2019-05-20T17:04:36 Z ioilolcom Nizin (COCI16_nizin) C++14
100 / 100
62 ms 6268 KB
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;
int arr[1000009];
int solve(int i,int j){
	if(i>=j) return 0;
	if(arr[i]==arr[j]) {
		return solve(i+1,j-1);
	}
	else if(arr[i]>arr[j]) {
		arr[j-1]+=arr[j];
		return 1+solve(i,j-1);
	}
	else {
		arr[i+1]+=arr[i];
		return 1+solve(i+1,j);
	}
}
int main()
{

	ios_base:: sync_with_stdio(false); cin.tie(0);
	int n; cin>>n;
	for(int i=1; i<=n; i++) cin>>arr[i];
	cout<<solve(1,n)<<endl;



	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 768 KB Output is correct
2 Correct 8 ms 896 KB Output is correct
3 Correct 9 ms 1024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 2432 KB Output is correct
2 Correct 27 ms 2816 KB Output is correct
3 Correct 32 ms 3320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 47 ms 4856 KB Output is correct
2 Correct 50 ms 5240 KB Output is correct
3 Correct 56 ms 5752 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 60 ms 6140 KB Output is correct
2 Correct 62 ms 6268 KB Output is correct
3 Correct 61 ms 6264 KB Output is correct