CSES - NOI 2024 - Results
Submission details
Task:Thin Ice
Sender:Sofie Fu
Submission time:2024-03-07 08:51:14 +0200
Language:C++ (C++11)
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:34:21: error: 'u' was not declared in this scope
   34 |         for(int i = u; i>=0; i--){
      |                     ^

Code

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define vo vector
#define pb push_back
#define sz(x) x.size()
#define fi first 
#define se second
typedef long long ll;
typedef pair<int ,int> pii;
typedef vo<int> vi;

#define rep(i, a, b) for(ll i=(a); i<(b); i++)
#define pr(x) cout << #x << " " << x << endl;
ll const inf = LLONG_MAX, mxn = 1e5+4;
int n, m, ans;

signed main(){
    cin.tie(0)->sync_with_stdio(0);
    cin>>n>>m;
    vi arr(m);
    rep(i, 0, m){
        cin>>arr[i];
    }
    
    if(n==1){
        int carry = 0;
        rep(i, 0, m){
            carry++;
            if(carry > arr[i]) carry = arr[i];
            ans = max(ans, carry);
        }
        for(int i = u; i>=0; i--){
            carry++;
            if(carry > arr[i]) carry = arr[i];
            ans = max(ans, carry);    
        }
    }

    cout << ans;
}

            // int carry = 0;
            // rep(i, u, m){
            //     rep(w, u+1, m){
            //         carry++;
            //         if(carry > arr[i]) carry = arr[i];
            //         ans = max(ans, carry);
            //     }
            // }
            // carry = 0;
            // for(int i = u; i>=0; i--){
            //     carry++;
            //     if(carry > arr[i]) carry = arr[i];
            //     ans = max(ans, carry);    
            // }

/*
precalc if each square can go home with a specific amt of coins
calc if we can get there with dfs from that square too
*/