/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 1ms 764.0 KiB
#2 Accepted 1ms 764.0 KiB
#3 Accepted 1ms 532.0 KiB
#4 Wrong Answer 1ms 532.0 KiB

Code

#include <bits/stdc++.h>
#define int long long
#define sqrtl(x) sqrt(x)
using namespace std;

namespace solve {
  namespace test_case {
    void main() {
      int n, k; cin >> n >> k;
      vector<int> a(n);
      for (auto &x: a) cin >> x;
      int i (0), j(n); 
      if (is_sorted(a.begin(), a.end())) cout << "YES\n" << 0 << ' ' << 0 << '\n';
      while (a[i + 1] > a[i] && i < n - 1) i++;
      while (a[j - 1] > a[j] && j > 0) j--;
      if (j - i <= k) cout << "YES\n" << i + 1 << ' ' << j << '\n'; 
      else cout << "NO\n";

    }
  }

  void main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t (1); // cin >> t; 
    while (t--) {
      test_case::main();
    }
  }
}

signed main() { solve::main(); }

Information

Submit By
Type
Submission
Problem
P1120 Stairway to the Skyline
Contest
Brain Booster #7
Language
C++17 (G++ 13.2.0)
Submit At
2024-11-05 15:42:34
Judged At
2024-11-05 15:42:34
Judged By
Score
4
Total Time
1ms
Peak Memory
764.0 KiB