답안 #113280

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
113280 2019-05-24T16:16:54 Z CaQtiml Nizin (COCI16_nizin) C++14
100 / 100
171 ms 6308 KB
#include "bits/stdc++.h"
using namespace std;
int arr[(int)1e6+10];
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[i+1]+=arr[i];
		return 1+solve(i+1,j);
	}
	else if(arr[i]>arr[j])
	{
		arr[j-1]+=arr[j];
		return 1+solve(i,j-1);
	}
}
int main()
{
	int n;
	cin >> n;
	for(int i=1;i<=n;i++) cin >> arr[i];
	cout << solve(1,n);
}

Compilation message

nizin.cpp: In function 'int solve(int, int)':
nizin.cpp:18:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 512 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 3 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 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 14 ms 768 KB Output is correct
2 Correct 19 ms 896 KB Output is correct
3 Correct 19 ms 896 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 55 ms 2424 KB Output is correct
2 Correct 66 ms 2808 KB Output is correct
3 Correct 79 ms 3484 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 116 ms 4828 KB Output is correct
2 Correct 124 ms 5240 KB Output is correct
3 Correct 146 ms 5776 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 171 ms 6260 KB Output is correct
2 Correct 167 ms 6304 KB Output is correct
3 Correct 155 ms 6308 KB Output is correct