結果
問題 |
No.3210 Fixed Sign Sequense
|
ユーザー |
|
提出日時 | 2025-07-25 21:29:31 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 685 bytes |
コンパイル時間 | 2,179 ms |
コンパイル使用メモリ | 198,440 KB |
実行使用メモリ | 7,840 KB |
最終ジャッジ日時 | 2025-07-25 21:29:38 |
合計ジャッジ時間 | 3,480 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 WA * 25 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #ifdef LOCAL #include <debug.h> #else #define dbg(...) 0 #define dbgn(...) 0 #endif void solve() { int n; string s; cin >> n >> s; vector<int> seq; for(int i = 0; i < n; i++) { if (s[i] == '-') { seq.push_back(-1e8 - i); } else if (s[i] == '0') { seq.push_back(0); } else if (s[i] == '+') { seq.push_back(1e8 + i); } } vector<int> lis; for(int x : seq) { auto it = upper_bound(lis.begin(), lis.end(), x); if (it == lis.end()) lis.push_back(x); else *it = x; } cout << lis.size() << '\n'; } int32_t main() { cin.tie(0)->sync_with_stdio(0); solve(); return 0; }