# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1026914 | 2024-07-18T13:37:17 Z | FIFI_cpp | Nizin (COCI16_nizin) | C++17 | 99 ms | 10068 KB |
#include <iostream> #include <vector> #include <algorithm> #include <numeric> #include <cstdlib> #include <cmath> #include <queue> #include <stack> #include <deque> #include <fstream> #include <iterator> #include <set> #include <map> #include <unordered_map> #include <iomanip> #include <cctype> #include <string> #include <cassert> #include <set> #include <bitset> #include <unordered_set> using ll = int64_t; #define pb push_back #define all(a) a.begin(),a.end() #define ppi pair<pair<int,int>,int> #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define int int64_t // xcode cant include bits/stdc++.h using namespace std; //ifstream fin ("sleepy.in"); //ofstream fout ("sleepy.out"); /* /\_/\ * (= ._.) * / > \> */ // encouraging cat const int INF = 100000000000000; const int mod = 1000000007; const int MAXN = 5002; int32_t main() { int n; cin >> n; vector<int> a(n); for (int i = 0;i < n;i++) { cin >> a[i]; } int l = 0,r = n - 1,hl = a[0],hr = a[n - 1]; int res = 0; while (l <= r) { if (hl == hr) { l++; r--; if (l <= r) { hl = a[l]; hr = a[r]; } } else { res++; if (l + 1 == r) break; if (hl < hr) { l++; hl += a[l]; } else { r--; hr += a[r]; } } } cout << res << '\n'; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 860 KB | Output is correct |
2 | Correct | 13 ms | 1328 KB | Output is correct |
3 | Correct | 9 ms | 1372 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 30 ms | 2908 KB | Output is correct |
2 | Correct | 36 ms | 4384 KB | Output is correct |
3 | Correct | 43 ms | 5204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 64 ms | 6232 KB | Output is correct |
2 | Correct | 68 ms | 8276 KB | Output is correct |
3 | Correct | 91 ms | 9300 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 86 ms | 8024 KB | Output is correct |
2 | Correct | 99 ms | 10068 KB | Output is correct |
3 | Correct | 92 ms | 10068 KB | Output is correct |