# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
102290 | SirCeness | Nizin (COCI16_nizin) | C++14 | 204 ms | 10260 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define mod 1000000007
typedef long long ll;
using namespace std;
int n;
ll arr[1000006];
int f(int i, int j){
if (i >= j) return 0;
if (arr[i] == arr[j]) return f(i+1, j-1);
else if (arr[i] > arr[j]){
arr[j-1] += arr[j];
return 1+f(i, j-1);
} else if (arr[j] > arr[i]){
arr[i+1] += arr[i];
return 1+f(i+1, j);
}
}
int main(){
//freopen("baskent.gir", "r", stdin);
cin >> n;
for (int i = 0; i < n; i++){
ll a;
cin >> a;
arr[i] = a;
}
cout << f(0, n-1) << endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |