제출 #1316973

#제출 시각아이디문제언어결과실행 시간메모리
1316973blackscreen1Growing Vegetables is Fun 4 (JOI21_ho_t1)C++20
0 / 100
1 ms332 KiB
#include <bits//stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset; #define ll long long #define iloop(m, h) for (auto i = m; i != h; i += (m < h ? 1 : -1)) #define jloop(m, h) for (auto j = m; j != h; j += (m < h ? 1 : -1)) #define kloop(m, h) for (auto k = m; k != h; k += (m < h ? 1 : -1)) #define pll pair<ll, ll> #define INF 1000000000000000 #define MOD1 1000000007 #define MOD2 998244353 #define MOD3 1000000009 int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll n; cin >> n; ll a[n-1]; ll pv = -1, t; iloop(0, n) { cin >> t; if (i) a[i-1] = t - pv; pv = t; } ll pre[n-1], suf[n-1]; iloop(0, n-1) pre[i] = max(1 - a[i], 0LL) + (i ? pre[i-1] : 0); iloop(n-1, -1) suf[i] = max(a[i] + 1, 0LL) + (i != n-2 ? suf[i+1] : 0); ll cans = INF; iloop(0, n-2) cans = min(cans, max(pre[i], suf[i+1])); cout << min({cans, suf[0], pre[n-2]}); }

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

Main.cpp: In function 'int main()':
Main.cpp:33:12: warning: argument to variable-length array is too large [-Wvla-larger-than=]
   33 |         ll pre[n-1], suf[n-1];
      |            ^~~
Main.cpp:33:12: note: limit is 9223372036854775807 bytes, but argument is 18446744073709551608
Main.cpp:33:22: warning: argument to variable-length array is too large [-Wvla-larger-than=]
   33 |         ll pre[n-1], suf[n-1];
      |                      ^~~
Main.cpp:33:22: note: limit is 9223372036854775807 bytes, but argument is 18446744073709551608
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...