Submission #208888

#TimeUsernameProblemLanguageResultExecution timeMemory
208888SenseiNizin (COCI16_nizin)C++14
100 / 100
119 ms10632 KiB
/* DATE: 2020-03-12 14:19:25 NAME: PROBLEM: COCI16_NIZIN */ #include <bits/stdc++.h> using namespace std; const int MAXN = 1e6; int main() { int n; cin >> n; deque<long long> dq; for (int i = 1; i <= n; i++) { int t; scanf("%d", &t); dq.push_back(t); } int ans = 0; while (dq.size() > 1) { if (dq.front() == dq.back()) { dq.pop_front(); dq.pop_back(); } else if (dq.front() > dq.back()) { long long x = dq.back(); dq.pop_back(); dq.back() += x; ans++; } else { long long x = dq.front(); dq.pop_front(); dq.front() += x; ans++; } } cout << ans << "\n"; return 0; }

Compilation message (stderr)

nizin.cpp: In function 'int main()':
nizin.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &t);
     ~~~~~^~~~~~~~~~
#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...