結果
| 問題 | No.3590 I Love Inversions |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-07-17 21:36:24 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 2,112 ms / 5,000 ms |
| + 22µs | |
| コード長 | 956 bytes |
| 記録 | |
| コンパイル時間 | 4,300 ms |
| コンパイル使用メモリ | 376,804 KB |
| 実行使用メモリ | 5,888 KB |
| 平均クエリ数 | 12104.46 |
| 最終ジャッジ日時 | 2026-07-17 21:37:24 |
| 合計ジャッジ時間 | 26,786 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 43 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#if __has_include("all.hpp")
#include "all.hpp"
#else
#include <atcoder/all>
#endif
using namespace atcoder;
long long op(long long a, long long b) { return a+b; }
long long e() { return 0; }
int target;
bool f(long long v) { return v < target; }
int main(void){
int n;
cin>>n;
vector<long long>ar(n,0);
for(int i=0;i<n;i++){
cout<<"? "<<1<<" "<<i+1<<endl;
long long a;
cin>>a;
if(a==-1)return 1;
ar[i]=a;
}
vector<int>ans(n);
segtree<long long, op, e> seg(vector<long long>(n,1));
for(int i=n-1;i>0;i--){
int tmp=ar[i]-ar[i-1];
target=tmp+1;
int index=seg.min_left<f>(n);
ans[i]=index;
seg.set(index-1,0);
}
target=1;
int index=seg.min_left<f>(n);
ans[0]=index;
cout<<"! ";
for(int i=0;i<n;i++){
cout<<ans[i]<<(i==n-1?"":" ");
}
cout<<endl;
return 0;
}