제출 #1272611

#제출 시각아이디문제언어결과실행 시간메모리
1272611marshziinAirplane (NOI23_airplane)C++20
0 / 100
29 ms572 KiB
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define pii pair<int,int>

const int maxn = 1e6 + 10;
int v[maxn];

int32_t main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n, m; cin >> n >> m;
    int res = 0, height = 0;
    for (int i = 0; i < n; i++) {
        int cur; cin >> cur;
        if(i == n - 1 || i == 0) continue;
        if(cur > height) {
            res += cur - height;
            height += cur - height;
        } else {
            height--; res++;
        }
    }

    if(height == 0) res++;
    else res += height;

    for (int i = 0; i < m; i++) {
        int a, b; cin >> a >> b;
    }

        
    cout << res << '\n';
    return 0;   
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...