제출 #1097116

#제출 시각아이디문제언어결과실행 시간메모리
1097116Trisanu_DasBouquet (EGOI24_bouquet)C++17
24 / 100
21 ms4280 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int dp[200005]; signed main() { ios::sync_with_stdio(0); cin.tie(0); bool subt1 = true; int n, rd; cin >> n; dp[0] = 1; for (int i = 0, l, r; i < n; i++) { cin >> l >> r; if (l == r) { if (!i) rd = l; else if (rd != l) subt1 = false; } else subt1 = false; if (i) dp[i] = dp[i - 1]; if (i > l) dp[i] = max(dp[i], dp[i - l - 1] + 1); } if (subt1) cout << (n + rd) / (rd + 1) << '\n'; else cout << dp[n - 1] << '\n'; }

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

Main.cpp: In function 'int main()':
Main.cpp:23:36: warning: 'rd' may be used uninitialized in this function [-Wmaybe-uninitialized]
   23 |  if (subt1) cout << (n + rd) / (rd + 1) << '\n';
      |                                ~~~~^~~~
#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...