QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#667349#2418. Inverted Decktassei903#Compile Error//C++231.1kb2024-10-22 22:21:082024-10-22 22:21:08

Judging History

你现在查看的是最新测评结果

  • [2024-10-22 22:21:08]
  • 评测
  • [2024-10-22 22:21:08]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define sz(x) (int)(x).size()
#define rep(i, l, r) for (int i = l; i < (r); i++)
#define all(x) begin(x), end(x)
#define endl "\n"

typedef long long ll;
typedef vector<int> vi;
typedef vector<pair<int, int>> vii;

template<class T> void out(T x) { cout << x << '\n'; }
template<class T> void out(vector<T> x) { for (int i = 0; i < sz(x); i++) cout << x[i] << " \n"[i == sz(x) - 1]; }
template<class T> void chmax(T &a, T x) {a = max(a, x);}

const ll inf = 1e13 + 100;

#include <atcoder/lazysegtree>

void solve(){
    int n;cin >> n;
    vi v(n);
    rep(i, 0, n)cin >> v[i];
    int j = -1;
    rep(i, 0, n-1) {
        if (v[i] > v[i+1]){j = i;break;}
    }

    if (j == -1) {cout << 1 << " " << 1 << endl; return;}

    int l = j, r = j + 1;
    while (l > 0 && v[l-1] >= v[l])l--;
    while (r < n - 1 && v[r] >= v[r+1])r++;
    reverse(v.begin()+l, v.begin() + r + 1);
    rep(i, 0, n-1)if (v[i] > v[i+1]) {
        cout << "impossible" << endl;
        return;
    }
    cout << l+1 << " " << r+1 << endl;

}

int main() {
    int T = 1;
    while (T--)solve();
}

详细

answer.code:18:10: fatal error: atcoder/lazysegtree: No such file or directory
   18 | #include <atcoder/lazysegtree>
      |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.