답안 #805658

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
805658 2023-08-03T19:37:08 Z AmrT Rabbit Carrot (LMIO19_triusis) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define lop(i,a,b) for(ll i = a; i < b; i++)
using namespace std;
ll mod = 1e9 + 7;

signed main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int n, k; cin >> n >> k;
    ll arr[n + 1] = {}, ans = 0; 
    lop(i, 0, n) cin >> arr[i + 1];

    for(int i = 0; i < n; i++){
        if(arr[i] + k < arr[i + 1]) ans++, arr[i + 1] = arr[i] + k;
    }

    cout << ans;
    return 0;
}

Compilation message

triusis.cpp:4:1: error: 'll' does not name a type
    4 | ll mod = 1e9 + 7;
      | ^~
triusis.cpp: In function 'int main()':
triusis.cpp:10:5: error: 'll' was not declared in this scope
   10 |     ll arr[n + 1] = {}, ans = 0;
      |     ^~
triusis.cpp:10:23: error: expected primary-expression before ',' token
   10 |     ll arr[n + 1] = {}, ans = 0;
      |                       ^
triusis.cpp:10:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   10 |     ll arr[n + 1] = {}, ans = 0;
      |                         ^~~
      |                         abs
triusis.cpp:11:9: error: expected ';' before 'i'
   11 |     lop(i, 0, n) cin >> arr[i + 1];
      |         ^
triusis.cpp:2:27: note: in definition of macro 'lop'
    2 | #define lop(i,a,b) for(ll i = a; i < b; i++)
      |                           ^
triusis.cpp:11:9: error: 'i' was not declared in this scope
   11 |     lop(i, 0, n) cin >> arr[i + 1];
      |         ^
triusis.cpp:2:34: note: in definition of macro 'lop'
    2 | #define lop(i,a,b) for(ll i = a; i < b; i++)
      |                                  ^
triusis.cpp:11:25: error: 'arr' was not declared in this scope
   11 |     lop(i, 0, n) cin >> arr[i + 1];
      |                         ^~~
triusis.cpp:14:12: error: 'arr' was not declared in this scope
   14 |         if(arr[i] + k < arr[i + 1]) ans++, arr[i + 1] = arr[i] + k;
      |            ^~~