Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
37044 申东铉 【S】T2 C++ 通过 100 51 MS 3400 KB 693 2025-03-02 14:12:43

Tests(50/50):


#include <bits/stdc++.h> using namespace std; int id,n,m,a[200005],b[200005],c[200005]; signed main () { cin >> id; cin >> n >> m; for (int i = 1;i <= n;i++) { cin >> a[i]; } a[1] = 1919810; int x = 0; for (int i = 2;i <= n;i++) { if (a[i] < a[i - 1]) { x++; b[x] = 1; } else { b[x]++; } } queue <int> q,bfs; for (int i = 2;i <= x;i++) { q.push(i); } int ans = 0; bfs.push(1); while (!bfs.empty()) { int u = bfs.front(); ans = max(ans,c[u]); bfs.pop(); for (int i = 1;i <= b[u] && !q.empty();i++) { int v = q.front(); q.pop(); bfs.push(v); c[v] = c[u] + 1; } } cout << ans + 1 << endl; return 0; }


测评信息: