Submission #1350719


Source Code Expand

#include <iostream>
#include <algorithm>
using namespace std;

//ベクターとかよくわかってないから
//めんどいからグローバル使っちゃう

const int MAX_N = 100; 
int N,M,T;
int a[MAX_N];

void solve();

void solve(){
   int ans = a[0] - M;

   for(int i = 1; i < N - 1; i++){
       if(a[i + 1] - a[i]  <= 2 * M){
           ans += a[i + 1] - a[i] - 2 * M;
       }
   }
   
   if(T - a[N - 1] - M > 0){
       ans += t - a[n - 1] - m;
   }
   
   cout << ans << endl;

}

int main(){

    cin >> N >> M >> T;

    for(int i = 0; i < N; i++){
        cin >> a[i];
    }

    solve();

    return 0;
}

Submission Info

Submission Time
Task B - 豪邸と宅配便
User asaaaai
Language C++14 (Clang 3.8.0)
Score 0
Code Size 671 Byte
Status CE

Compile Error

./Main.cpp:24:15: error: use of undeclared identifier 't'
       ans += t - a[n - 1] - m;
              ^
./Main.cpp:24:21: error: use of undeclared identifier 'n'
       ans += t - a[n - 1] - m;
                    ^
./Main.cpp:24:30: error: use of undeclared identifier 'm'
       ans += t - a[n - 1] - m;
                             ^
3 errors generated.