Submission #1109264

#TimeUsernameProblemLanguageResultExecution timeMemory
1109264TsaganaSkyline (IZhO11_skyline)C++14
0 / 100
2037 ms760 KiB
#include<bits/stdc++.h> #define IOS ios_base::sync_with_stdio(false);cin.tie();cout.tie(); #define all(x) x.begin(), x.end() #define lnl long long #define pq priority_queue #define eb emplace_back #define lb lower_bound #define ub upper_bound #define pb push_back #define pp pop_back #define F first #define S second using namespace std; int antiloop = 0; int mn = INT_MAX; void calc(int l, int r, vector<int> v, int k) { for (int i = l; i <= r; i++) v[i]--; while (!v[l] && l < v.size()) l++; if (l == v.size()) {mn = min(mn, k); return ;} for (int i = l; i <= l + 2; i++) { if (!v[i] || i == v.size()) break ; if (i == l) calc(l, i, v, k + 3); if (i == l+1) calc(l, i, v, k + 5); if (i == l+2) calc(l, i, v, k + 7); } } void solve () { int n; cin >> n; vector<int> v(n); for (auto &i: v) cin >> i; calc(0, -1, v, 0); cout << mn; } int main() {IOS solve(); return 0;}

Compilation message (stderr)

skyline.cpp: In function 'void calc(int, int, std::vector<int>, int)':
skyline.cpp:23:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |  while (!v[l] && l < v.size()) l++;
      |                  ~~^~~~~~~~~~
skyline.cpp:25:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |  if (l == v.size()) {mn = min(mn, k); return ;}
      |      ~~^~~~~~~~~~~
skyline.cpp:28:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |   if (!v[i] || i == v.size()) break ;
      |                ~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...