제출 #1129162

#제출 시각아이디문제언어결과실행 시간메모리
1129162mnbvcxz123Nizin (COCI16_nizin)C++20
100 / 100
117 ms4328 KiB
#include <bits/stdc++.h> using namespace std; int n; vector <int> nums; int main() { cin >> n; nums.resize(n); for (int i = 0; i < n; i++) cin >> nums[i]; int ans = 0; int l = 0, r = n-1; int suml = nums[0], sumr = nums[n-1]; while (l < r) { if (suml == sumr) { suml = nums[l+1]; sumr = nums[r-1]; l++; r--; } else if (suml < sumr) { suml += nums[l+1]; ans++; l++; } else { sumr += nums[r-1]; ans++; r--; } } cout << ans << '\n'; }
#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...