結果
| 問題 |
No.2930 Larger Mex
|
| コンテスト | |
| ユーザー |
yel_ow
|
| 提出日時 | 2024-11-24 02:27:35 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,088 bytes |
| コンパイル時間 | 3,737 ms |
| コンパイル使用メモリ | 251,324 KB |
| 実行使用メモリ | 14,976 KB |
| 最終ジャッジ日時 | 2024-11-24 02:27:57 |
| 合計ジャッジ時間 | 21,149 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 WA * 2 RE * 16 |
ソースコード
//#include <monsterenergy>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int MAX = 1e9;
const int MIN = -1*1e9;
const ll MAXLL = 1e18;
const ll MINLL = -1*1e18;
int main()
{
int N,M; cin >> N >> M;
if(M == 0)
{
for(int i = 0; i < N; i++) cout << N-i << endl;
return 0;
}
M--;
vector<int> V(N);
for(int i = 0; i < N; i++) cin >> V[i];
vector<int> Count(M+1),Ans(N+2);
set<int> S;
int r = 0;
for(int l = 0; l < N; l++)
{
if(l)
{
Count[V[l-1]]--;
if(Count[V[l-1]] == 0) S.erase(V[l-1]);
}
while(S.size() <= M)
{
if(r == N) break;
Count[V[r]]++;
if(Count[V[r]] == 1 && V[r] <= M) S.insert(V[r]);
r++;
}
if(S.size() <= M) continue;
Ans[r-l]++;
Ans[N-l+1]--;
}
for(int i = 1; i <= N; i++)
{
Ans[i+1] += Ans[i];
cout << Ans[i] << endl;
}
return 0;
}
yel_ow