제출 #1112415

#제출 시각아이디문제언어결과실행 시간메모리
1112415vjudge1Baloni (COCI15_baloni)C++17
100 / 100
1878 ms3896 KiB
#include <bits/stdc++.h> using namespace std; int n,h[1000000],counter; inline void arrow(int height,int index) { counter++; for (int i = index; height>0 && i<n; i++) { if(h[i]==height) { height--; h[i] = 0; } } } int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> h[i]; } for (int i = 0; i < n; i++) { if(h[i]) { arrow(h[i],i); } } cout << counter; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...