답안 #83596

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
83596 2018-11-09T12:52:37 Z Genezio Nizin (COCI16_nizin) C++14
100 / 100
100 ms 4648 KB
#include<bits/stdc++.h>

using namespace std;
#define pii pair<int,int>
#define mp make_pair
#define F first
#define S second
#define pb push_back
#define ll long long

const int N = 1000010;
const int INF = 0x3f3f3f3f;
const ll mod = 1e9+7;

 int v[N];

 int f(int x,int y,int sumx,int sumy) {
 	if(y<=x) return 0;
 	if(v[x]+sumx==v[y]+sumy) return f(x+1,y-1,0,0);
 	if(v[x]+sumx<v[y]+sumy) {
 		return 1+f(x+1,y,sumx+v[x],sumy);
 	} else {
 		return 1+f(x,y-1,sumx,sumy+v[y]);
 	}
 }

int main() {
	ios::sync_with_stdio(false);
 	cin.tie(0);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++) {
        cin>>v[i];
    }
    cout<<f(1,n,0,0)<<"\n";
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 2 ms 468 KB Output is correct
3 Correct 2 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 476 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 520 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 696 KB Output is correct
2 Correct 2 ms 696 KB Output is correct
3 Correct 2 ms 696 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 696 KB Output is correct
2 Correct 2 ms 708 KB Output is correct
3 Correct 2 ms 708 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 708 KB Output is correct
2 Correct 2 ms 708 KB Output is correct
3 Correct 2 ms 708 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 708 KB Output is correct
2 Correct 2 ms 708 KB Output is correct
3 Correct 2 ms 708 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 892 KB Output is correct
2 Correct 9 ms 1020 KB Output is correct
3 Correct 9 ms 1020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 1916 KB Output is correct
2 Correct 32 ms 2300 KB Output is correct
3 Correct 37 ms 2556 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 57 ms 3580 KB Output is correct
2 Correct 59 ms 3732 KB Output is correct
3 Correct 65 ms 4096 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 90 ms 4604 KB Output is correct
2 Correct 80 ms 4648 KB Output is correct
3 Correct 100 ms 4648 KB Output is correct