結果
| 問題 |
No.3238 Shadow
|
| コンテスト | |
| ユーザー |
SnowBeenDiding
|
| 提出日時 | 2025-08-16 20:33:42 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 65 ms / 2,000 ms |
| コード長 | 747 bytes |
| コンパイル時間 | 5,408 ms |
| コンパイル使用メモリ | 335,136 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-08-16 20:33:50 |
| 合計ジャッジ時間 | 7,474 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
using namespace atcoder;
using namespace std;
typedef long long ll;
void solve() {
int n;
cin >> n;
vector<int> dp(n, 1e9);
vector<pair<int, int>> ans;
rep(k, 0, n) {
int x;
cin >> x;
int i = lower_bound(dp.begin(), dp.end(), x) - dp.begin();
if (dp[i] == 1e9) {
ans.push_back({k + 1, -1});
}
dp[i] = x;
}
rep(i, 0, ans.size()) ans[i].second = dp[i];
for (auto &p : ans) {
cout << p.first << " " << p.second << "\n";
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
while (t--) solve();
}
SnowBeenDiding