結果
| 問題 | No.3590 I Love Inversions |
| コンテスト | |
| ユーザー |
Kude
|
| 提出日時 | 2026-07-17 21:26:28 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 2,108 ms / 5,000 ms |
| + 32µs | |
| コード長 | 1,244 bytes |
| 記録 | |
| コンパイル時間 | 2,694 ms |
| コンパイル使用メモリ | 359,256 KB |
| 実行使用メモリ | 5,888 KB |
| 平均クエリ数 | 12103.46 |
| 最終ジャッジ日時 | 2026-07-17 21:27:00 |
| 合計ジャッジ時間 | 25,148 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 43 |
ソースコード
#include<bits/stdc++.h>
namespace {
#pragma GCC diagnostic ignored "-Wunused-function"
#include<atcoder/all>
#pragma GCC diagnostic warning "-Wunused-function"
using namespace std;
using namespace atcoder;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--)
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }
template<class T> bool chmin(T& a, const T& b) { if (b < a) { a = b; return true; } else return false; }
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
} int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
VL a(n);
rep(i, n) if (i) {
cout << "? " << 1 << ' ' << i + 1 << endl;
cin >> a[i];
}
segtree<int, [](int x, int y) { return x + y; }, []() { return 0; }> seg(VI(n, 1));
VI b(n);
rrep(i, n) {
int d = a[i] - (i == 0 ? 0LL : a[i-1]);
int p = seg.min_left(n, [&](int x) { return x <= d; }) - 1;
b[i] = p;
seg.set(p, 0);
}
cout << "!";
for (int i : b) cout << ' ' << i + 1;
cout << endl;
}
Kude