제출 #792057

#제출 시각아이디문제언어결과실행 시간메모리
792057hariaakas646Growing Vegetables is Fun 4 (JOI21_ho_t1)C++17
100 / 100
26 ms6192 KiB
#include <bits/stdc++.h> using namespace std; #define scd(t) scanf("%d", &t) #define sclld(t) scanf("%lld", &t) #define forr(i, j, k) for (int i = j; i < k; i++) #define frange(i, j) forr(i, 0, j) #define all(cont) cont.begin(), cont.end() #define mp make_pair #define pb push_back #define f first #define s second typedef long long int lli; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<bool> vb; typedef vector<lli> vll; typedef vector<string> vs; typedef vector<pii> vii; typedef vector<vi> vvi; typedef map<int, int> mpii; typedef set<int> seti; typedef multiset<int> mseti; typedef long double ld; int main() { int n; scd(n); vi vec(n); frange(i, n) { scd(vec[i]); } vll ord(n), rev(n); int curr = vec[0] + 1; forr(i, 1, n) { ord[i] = ord[i - 1] + max(0, vec[i - 1] - vec[i] + 1); curr = max(vec[i], curr) + 1; } curr = vec[n - 1] + 1; for (int i = n - 2; i >= 0; i--) { rev[i] = rev[i + 1] + max(0, vec[i + 1] - vec[i] + 1); curr = max(vec[i], curr) + 1; } lli mi = 1e18; frange(i, n) { mi = min(mi, max(ord[i], rev[i])); } printf("%lld", mi); }

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

Main.cpp: In function 'int main()':
Main.cpp:5:21: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 | #define scd(t) scanf("%d", &t)
      |                ~~~~~^~~~~~~~~~
Main.cpp:30:5: note: in expansion of macro 'scd'
   30 |     scd(n);
      |     ^~~
Main.cpp:5:21: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 | #define scd(t) scanf("%d", &t)
      |                ~~~~~^~~~~~~~~~
Main.cpp:34:9: note: in expansion of macro 'scd'
   34 |         scd(vec[i]);
      |         ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...