提出 #73491986
ソースコード 拡げる
#include <iostream>
using namespace std;
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <atcoder/all>
#include <cmath>
#include <string>
#include <bitset>
using namespace atcoder;
using mint = modint998244353;
// using mint = modint;
// using mint = modint1000000007;
// combination
// https://github.com/atcoder/live_library/blob/cb2068b050b3fbeedd39321b3713ed6546fbeffa/comb.cpp#L31
using ll = long long;
using P = pair<int,int>;
#define rep(i,n) for(int i = 0; i < (n); ++i)
// int di[] = {1,1,1,0,0,-1,-1,-1};
// int dj[] = {1,0,-1,1,-1,1,0,-1};
// int di[] = {1,1,-1,-1};
// int dj[] = {1,-1,-1,-1};
int di[] = {0,1,0,-1};
int dj[] = {1,0,-1,0};
void chmin(int &x, int y){
x = min(x,y);
}
void chmax(ll &x, ll y){
x = max(x,y);
}
// int dist[2][505][505];
// mint f(ll n) {
// return (mint)n*(n+1)/2;
// }
int main() {
int n; cin >> n;
vector<int> a(n);
rep(i,n) cin >> a[i];
map<int,int> dp;
rep(i,n) {
int x = a[i];
dp[x] = max(dp[x],dp[x-1]+1);
}
int ans = 0;
for(auto[i, x] : dp) ans = max(ans,x);
cout << ans << endl;
return 0;
}
提出情報
| 提出日時 |
|
| 問題 |
D - Max Straight |
| ユーザ |
Asaknkn |
| 言語 |
C++23 (GCC 15.2.0) |
| 得点 |
400 |
| コード長 |
1256 Byte |
| 結果 |
AC |
| 実行時間 |
188 ms |
| メモリ |
22836 KiB |
ジャッジ結果
| セット名 |
Sample |
All |
| 得点 / 配点 |
0 / 0 |
400 / 400 |
| 結果 |
|
|
| セット名 |
テストケース |
| 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 |
3584 KiB |
| 00_sample_01.txt |
AC |
1 ms |
3592 KiB |
| 00_sample_02.txt |
AC |
1 ms |
3404 KiB |
| 01_random_00.txt |
AC |
1 ms |
3412 KiB |
| 01_random_01.txt |
AC |
1 ms |
3544 KiB |
| 01_random_02.txt |
AC |
1 ms |
3556 KiB |
| 01_random_03.txt |
AC |
88 ms |
13512 KiB |
| 01_random_04.txt |
AC |
101 ms |
13384 KiB |
| 01_random_05.txt |
AC |
103 ms |
14776 KiB |
| 01_random_06.txt |
AC |
45 ms |
9028 KiB |
| 01_random_07.txt |
AC |
188 ms |
22836 KiB |
| 01_random_08.txt |
AC |
28 ms |
3624 KiB |
| 01_random_09.txt |
AC |
1 ms |
3748 KiB |
| 01_random_10.txt |
AC |
69 ms |
4040 KiB |
| 01_random_11.txt |
AC |
72 ms |
4160 KiB |
| 01_random_12.txt |
AC |
8 ms |
3728 KiB |
| 01_random_13.txt |
AC |
75 ms |
4152 KiB |
| 01_random_14.txt |
AC |
3 ms |
3676 KiB |
| 01_random_15.txt |
AC |
81 ms |
4400 KiB |
| 01_random_16.txt |
AC |
42 ms |
3900 KiB |
| 01_random_17.txt |
AC |
83 ms |
13508 KiB |
| 01_random_18.txt |
AC |
79 ms |
13252 KiB |
| 01_random_19.txt |
AC |
96 ms |
13512 KiB |
| 01_random_20.txt |
AC |
64 ms |
10416 KiB |
| 01_random_21.txt |
AC |
121 ms |
13496 KiB |
| 01_random_22.txt |
AC |
9 ms |
4292 KiB |