Language: C++

#include <iostream>
#include <limits.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main(void){
    int n, t[105], v[105];
    cin >> n;
    
    int u[105];
    for (int i = 0; i < n; i++) {
        cin >> t[i];
        u[i] = 0;
    }
    for (int i = 0; i < n; i++) {
        for (int j = i; j < n; j++) {
            u[i] += t[j];
        }
    }
    u[n] = 0;
    
    int w[105], w_min = 101, w_minnum;
    v[n] = 0;
    for (int i = 0; i <= n; i++) {
        if (i != n) cin >> v[i];
        if (i != 0) w[i] = v[i] + u[1] - u[i];
        else w[i] = v[i];
        if (w_min > w[i]) {
            w_min = min(w_min, w[i]);
            w_minnum = i;
        }
    }
    
    int now_time = 0, now_stn = 0, now_vel = 0;
    float ans = 0.0;
    
    if (w_minnum == now_stn) {
        if (t[now_stn] <= v[now_stn]) {
            ans += float(t[now_stn] * t[nowc] / 2);
        }
        else {
            ans += float(t[now_stn] * v[now_stn] - pow(v[now_stn], 2) / 2);
        }
    }
    else {
        float l = (t[now_stn] + now_vel + w_min) / 2;
        ans += float((pow(l, 2) - pow(now_vel, 2)) / 2 + (pow(l, 2) - pow(w_min, 2)) / 2);
        if (l > v[now_stn]) ans -= float(pow(l - v[now_stn], 2));
    }
    
    
    while (now_stn < n) {
        if (w_minnum == now_stn) {
            if (t[now_stn] <= v[now_stn]) {
                ans += float(t[now_stn] * t[nowc] / 2);
            }
            else {
                ans += float(t[now_stn] * v[now_stn] - pow(v[now_stn], 2) / 2);
            }
        }
        else {
            float l = (t[now_stn] + now_vel + w_min) / 2;
            ans += float((pow(l, 2) - pow(now_vel, 2)) / 2 + (pow(l, 2) - pow(w_min, 2)) / 2);
            if (l > v[now_stn]) ans -= float(pow(l - v[now_stn], 2));
        }
        
        
        
        for (int i = nowc; i <= w_minnum; i++) now += t[i];
        vel = w[w_minnum];
        nowc = w_minnum + 1;
        
        w_min = 101;
        for (int i = nowc; i < n; i++) {
            if (i == nowc) w[i] = v[i];
            else w[i] = v[i] + u[nowc] - u[i];
            if (w_min > w[i]) {
                w_min = min(w_min, w[i]);
                w_minnum = i;
            }
        }
    }
    
    cout << ans << endl;
    
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:41: error: 'nowc' was not declared in this scope
   41 |             ans += float(t[now_stn] * t[nowc] / 2);
      |                                         ^~~~
a.cc:57:45: error: 'nowc' was not declared in this scope
   57 |                 ans += float(t[now_stn] * t[nowc] / 2);
      |                                             ^~~~
a.cc:71:22: error: 'nowc' was not declared in this scope
   71 |         for (int i = nowc; i <= w_minnum; i++) now += t[i];
      |                      ^~~~
a.cc:71:48: error: 'now' was not declared in this scope; did you mean 'pow'?
   71 |         for (int i = nowc; i <= w_minnum; i++) now += t[i];
      |                                                ^~~
      |                                                pow
a.cc:72:9: error: 'vel' was not declared in this scope
   72 |         vel = w[w_minnum];
      |         ^~~
a.cc:73:9: error: 'nowc' was not declared in this scope
   73 |         nowc = w_minnum + 1;
      |         ^~~~