제출 #1228753

#제출 시각아이디문제언어결과실행 시간메모리
1228753khoinguRabbit Carrot (LMIO19_triusis)C++20
0 / 100
1 ms328 KiB
#include <bits/stdc++.h> #define ll long long #define fi(i,a,b) for(int i = a; i <= b; i ++) using namespace std; const ll maxN = 2e5 + 5; int n, m, a[maxN]; signed main() { if (fopen("task.inp", "r")) { freopen("task.inp", "r", stdin); freopen("task.out", "w", stdout); } ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> m; for(int i = 1; i <= n; i ++) cin >> a[i]; int cnt = 0; for(int i = 1; i + 1 <= n; i ++) { if (a[i + 1] > a[i] + m) { a[i + 1] = a[i] + m; cnt ++; } } cout << cnt; }

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

triusis.cpp: In function 'int main()':
triusis.cpp:11:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         freopen("task.inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
triusis.cpp:12:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         freopen("task.out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...