제출 #1092704

#제출 시각아이디문제언어결과실행 시간메모리
1092704I_am_Polish_GirlGrowing Vegetables is Fun 4 (JOI21_ho_t1)C++14
100 / 100
21 ms10244 KiB
#pragma GCC optimize("Ofast") #pragma GCC optimize("O3") #pragma GCC optimization ("unroll-loops") #include <vector> #include <algorithm> #include <map> #include <set> #include <unordered_map> #include <unordered_set> #include <stack> #include <queue> #include <cmath> #include <random> #include <chrono> #include <iomanip> #include <iostream> #include <bitset> #define int long long using namespace std; int log_ = 3; int inf = 200000000000000; int mod = 5; int p = 505; signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n; vector <int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; vector <int> col(n); vector <int> pref(n); col[0] = 0; pref[0] = a[0]; for (int i = 1; i < n; i++) { int x = 0; if (a[i] <= a[i - 1]) { x = a[i - 1] - a[i] +1; } col[i] = col[i - 1] + x; pref[i] = a[i] + x; } vector <int> col_syf(n); vector <int> pref_syf(n); col_syf[n - 1] = 0; pref_syf[n - 1] = a[n - 1]; for (int i = n - 2; i >= 0; i--) { int x = 0; if (a[i] <= a[i + 1]) { x = a[i + 1] - a[i] + 1; } col_syf[i] = col_syf[i + 1] + x; pref_syf[i] = a[i] + x; } int ans = inf; for (int i = 0; i < n; i++) { ans = min(ans, max(col[i], col_syf[i])); } cout << ans; }

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp:4: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    4 | #pragma GCC optimization ("unroll-loops")
      |
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...