제출 #1228988

#제출 시각아이디문제언어결과실행 시간메모리
1228988HduongRabbit Carrot (LMIO19_triusis)C++20
0 / 100
1 ms328 KiB
#include <bits/stdc++.h>
#define task "task"

using namespace std;
const long long INF = 1e18;
const int N = 2e5 + 5;
long long n, m, a[N];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);

  if (fopen (task".inp", "r")) {
    freopen (task".inp", "r", stdin);
    freopen (task".out", "w", stdout);
  }

  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  long long pre = 0, res = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] - pre > m) {
      ++res;
      pre += m;
    }
    else pre = a[i];
  }
  cout << res;
}

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

triusis.cpp: In function 'int main()':
triusis.cpp:14:13: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     freopen (task".inp", "r", stdin);
      |     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
triusis.cpp:15:13: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     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...