結果
| 問題 |
No.365 ジェンガソート
|
| コンテスト | |
| ユーザー |
hitonanode
|
| 提出日時 | 2020-09-24 23:01:50 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 30 ms / 2,000 ms |
| コード長 | 399 bytes |
| コンパイル時間 | 491 ms |
| コンパイル使用メモリ | 71,388 KB |
| 最終ジャッジ日時 | 2025-01-14 20:10:57 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 41 |
ソースコード
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int N;
cin >> N;
vector<int> a2i(N);
for (int i = 0; i < N; i++)
{
int a;
cin >> a;
a2i[a - 1] = i;
}
int high = N, ret = 0;
for (int a = N - 1; a >= 0; a--)
{
if (a2i[a] > high) ret++, high = -1;
else high = a2i[a];
}
cout << ret << '\n';
}
hitonanode