Submission #102290

#TimeUsernameProblemLanguageResultExecution timeMemory
102290SirCenessNizin (COCI16_nizin)C++14
100 / 100
204 ms10260 KiB
#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)

nizin.cpp: In function 'int f(int, int)':
nizin.cpp:22:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...