卬高杯
| 提出id | 提出時刻 | ユーザー名 | 問題 | 言語 | 判定状況 | 判定 | 実行時間 |
|---|---|---|---|---|---|---|---|
| 114890 | 2023-10-24 10:29:54 | euommo | H | cpp | - | CE | -1 |
#include <bits/stdc++.h>
int main() {
std::cin.tie(0)->sync_with_stdio(0);
std::cin.exceptions(std::cin.failbit);
int N;
std::cin >> N;
std::vector<std::string> S(N);
for (std::string &s: S)
std::cin >> s;
int ans = 0;
std::vector<std::vector<int>> dp(1 << N, std::vector<int>(N, 0));
for (int i = 0; i < (1 << N); ++i) {
for (int j = 0; j < N; ++j) if (i >> j & 1) {
for (int k = 0; k < N; ++k) if (k != j and (i >> k & 1) and S[k].back() == S[j][0])
dp[i][j] = std::max(dp[i][j], dp[i ^ (1 << j)][k]);
dp[i][j] += (int) S[j].size();
ans = max(ans, dp[i][j]);
}
}
std::cout << ans << '\n';
return 0;
}
-1 CE-1 CE
/var/www/judge/submit2/114890/a.cpp: In function ‘int main()’:
/var/www/judge/submit2/114890/a.cpp:21:13: error: ‘max’ was not declared in this scope
21 | ans = max(ans, dp[i][j]);
| ^~~
/var/www/judge/submit2/114890/a.cpp:21:13: note: suggested alternatives:
In file included from /usr/include/c++/11/string:52,
from /usr/include/c++/11/bits/locale_classes.h:40,
from /usr/include/c++/11/bits/ios_base.h:41,
from /usr/include/c++/11/ios:42,
from /usr/include/c++/11/istream:38,
from /usr/include/c++/11/sstream:38,
from /usr/include/c++/11/complex:45,
from /usr/include/c++/11/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
from /var/www/judge/submit2/114890/a.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: ‘std::max’
3467 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
In file included from /usr/include/c++/11/algorithm:64,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
from /var/www/judge/submit2/114890/a.cpp:1:
/usr/include/c++/11/bits/ranges_algo.h:3011:29: note: ‘std::ranges::max’
3011 | inline constexpr __max_fn max{};
| ^~~