結果
| 問題 | No.3590 I Love Inversions |
| コンテスト | |
| ユーザー |
shobonvip
|
| 提出日時 | 2026-07-17 21:32:40 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 1,862 ms / 5,000 ms |
| + 28µs | |
| コード長 | 1,883 bytes |
| 記録 | |
| コンパイル時間 | 4,034 ms |
| コンパイル使用メモリ | 376,676 KB |
| 実行使用メモリ | 5,888 KB |
| 平均クエリ数 | 12104.46 |
| 最終ジャッジ日時 | 2026-07-17 21:33:05 |
| 合計ジャッジ時間 | 24,219 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 43 |
ソースコード
/**
author: shobonvip
created: 2026.07.17 21:27:14
**/
#include<bits/stdc++.h>
using namespace std;
//* ATCODER
#include<atcoder/all>
using namespace atcoder;
typedef modint998244353 mint;
//*/
/* BOOST MULTIPRECISION
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
//*/
typedef long long ll;
#define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
#define rrep(i, s, n) for (int i = (int)(n)-1; i >= (int)(s); i--)
#define all(v) v.begin(), v.end()
template <typename T> bool chmin(T &a, const T &b) {
if (a <= b) return false;
a = b;
return true;
}
template <typename T> bool chmax(T &a, const T &b) {
if (a >= b) return false;
a = b;
return true;
}
template <typename T> T max(vector<T> &a){
assert(!a.empty());
T ret = a[0];
for (int i=0; i<(int)a.size(); i++) chmax(ret, a[i]);
return ret;
}
template <typename T> T min(vector<T> &a){
assert(!a.empty());
T ret = a[0];
for (int i=0; i<(int)a.size(); i++) chmin(ret, a[i]);
return ret;
}
template <typename T> T sum(vector<T> &a){
T ret = 0;
for (int i=0; i<(int)a.size(); i++) ret += a[i];
return ret;
}
ll op(ll a, ll b) {
return a + b;
}
ll e() {
return 0LL;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n; cin >> n;
auto ask = [&](int l, int r) -> ll {
cout << '?' << ' ' << l + 1 << ' ' << r << endl;
ll x; cin >> x;
return x;
};
auto answer = [&](vector<int> p) -> void {
cout << "!";
rep(i,0,n) {
cout << ' ' << p[i] + 1;
}
cout << endl;
return;
};
ll now = ask(0, n);
segtree<ll,op,e> seg(vector<ll>(n,1LL));
ll y;
auto f = [&](ll x) -> ll {
return x <= y;
};
vector<int> ans(n);
rep(i,0,n-1) {
ll vt = ask(i+1, n);
y = now - vt;
int rt = seg.max_right(0, f);
seg.set(rt, 0);
ans[i] = rt;
now = vt;
}
y = 0;
ans[n-1] = seg.max_right(0, f);
answer(ans);
}
shobonvip