提出 #73485612


ソースコード 拡げる

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define Int long long
#define itn long long
#define iint long long
const int N=2e5+10;
int n,a[N],b[N],maxn=-1,ans;
inline int read() {
	int x = 0, f = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9') {
		if (ch == '-')
			f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = (x << 3) + (x << 1) + (ch ^ 48);
		ch = getchar();
	}
	return x * f;
}
inline void write(int x) {
	if (x < 0) {
		putchar('-');
		x = -x;
	}
	if (x > 9)
		write(x / 10);
	putchar(x % 10 + '0');
}
signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	unordered_map<int,int> dp;
	for(int i=1;i<=n;i++){
		int x=a[i];
		int cur=dp[x-1]+1;
		dp[x]=max(dp[x],cur);
		ans=max(ans,dp[x]);
	}
	cout<<ans;
	return 0;
}

提出情報

提出日時
問題 D - Max Straight
ユーザ ccy20130127
言語 C++23 (GCC 15.2.0)
得点 400
コード長 885 Byte
結果 AC
実行時間 68 ms
メモリ 24192 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 400 / 400
結果
AC × 3
AC × 26
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3612 KiB
00_sample_01.txt AC 1 ms 3468 KiB
00_sample_02.txt AC 1 ms 3636 KiB
01_random_00.txt AC 1 ms 3612 KiB
01_random_01.txt AC 1 ms 3476 KiB
01_random_02.txt AC 1 ms 3636 KiB
01_random_03.txt AC 17 ms 14292 KiB
01_random_04.txt AC 18 ms 14348 KiB
01_random_05.txt AC 33 ms 14336 KiB
01_random_06.txt AC 14 ms 8636 KiB
01_random_07.txt AC 68 ms 24192 KiB
01_random_08.txt AC 4 ms 4360 KiB
01_random_09.txt AC 1 ms 3596 KiB
01_random_10.txt AC 10 ms 5228 KiB
01_random_11.txt AC 12 ms 5312 KiB
01_random_12.txt AC 2 ms 3800 KiB
01_random_13.txt AC 13 ms 5356 KiB
01_random_14.txt AC 1 ms 3692 KiB
01_random_15.txt AC 14 ms 5556 KiB
01_random_16.txt AC 7 ms 4616 KiB
01_random_17.txt AC 22 ms 14284 KiB
01_random_18.txt AC 22 ms 14192 KiB
01_random_19.txt AC 27 ms 14300 KiB
01_random_20.txt AC 17 ms 10168 KiB
01_random_21.txt AC 32 ms 14304 KiB
01_random_22.txt AC 3 ms 4496 KiB