結果
| 問題 |
No.1525 Meximum Sum
|
| ユーザー |
|
| 提出日時 | 2021-05-28 22:37:13 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 667 bytes |
| コンパイル時間 | 3,142 ms |
| コンパイル使用メモリ | 106,076 KB |
| 最終ジャッジ日時 | 2025-01-21 20:13:10 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 5 TLE * 18 |
ソースコード
#pragma GCC target("avx512f")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")
#include <ios>
#include <unordered_set>
using namespace std;
template<class T>
inline void scan_uint(T& a) noexcept {
a = 0;
for (char c = getchar_unlocked(); isdigit(c); c = getchar_unlocked()) a = a * 10 + c - '0';
}
int main() {
int n;
scan_uint(n);
int a[200000];
for (int i = 0; i < n; ++i) scan_uint(a[i]);
int ans = 0, k;
unordered_set<int> s;
for (int i = 0; i < n; ++i) {
s.clear();
k = 0;
for (int j = i; j < n; ++j) {
s.emplace(a[j]);
while (s.find(k) != s.end()) ++k;
ans += k;
}
}
printf("%d", ans);
}