結果
| 問題 | No.497 入れ子の箱 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-12-10 14:51:07 |
| 言語 | C++17(gcc12) (gcc 12.4.0 + boost 1.89.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 941 bytes |
| 記録 | |
| コンパイル時間 | 720 ms |
| コンパイル使用メモリ | 105,200 KB |
| 最終ジャッジ日時 | 2026-03-08 21:18:17 |
| 合計ジャッジ時間 | 1,416 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:25:30: error: no match for ‘operator[]’ (operand types are ‘__gnu_cxx::__alloc_traits<std::allocator<std::array<int, 3> >, std::array<int, 3> >::value_type’ {aka ‘std::array<int, 3>’} and ‘int’)
25 | scanf("%d", &v[i][j]);
| ^
main.cpp:27:18: error: invalid use of incomplete type ‘__gnu_cxx::__alloc_traits<std::allocator<std::array<int, 3> >, std::array<int, 3> >::value_type’ {aka ‘struct std::array<int, 3>’}
27 | sort(v[i].begin(),v[i].end());
| ^
In file included from /usr/include/c++/12/bits/stl_map.h:63,
from /usr/include/c++/12/map:61,
from main.cpp:4:
/usr/include/c++/12/tuple:1610:45: note: declaration of ‘__gnu_cxx::__alloc_traits<std::allocator<std::array<int, 3> >, std::array<int, 3> >::value_type’ {aka ‘struct std::array<int, 3>’}
1610 | template<typename _Tp, size_t _Nm> struct array;
| ^~~~~
main.cpp:27:31: error: invalid use of incomplete type ‘__gnu_cxx::__alloc_traits<std::allocator<std::array<int, 3> >, std::array<int, 3> >::value_type’ {aka ‘struct std::array<int, 3>’}
27 | sort(v[i].begin(),v[i].end());
| ^
/usr/include/c++/12/tuple:1610:45: note: declaration of ‘__gnu_cxx::__alloc_traits<std::allocator<std::array<int, 3> >, std::array<int, 3> >::value_type’ {aka ‘struct std::array<int, 3>’}
1610 | template<typename _Tp, size_t _Nm> struct array;
| ^~~~~
main.cpp:33:20: error: no match for ‘operator[]’ (operand types are ‘__gnu_cxx::__alloc_traits<std::allocator<std::array<int, 3> >, std::array<int, 3> >::value_type’ {aka ‘std::array<int, 3>’} and ‘int’)
33 | if(v[j][0] < v[i][0] && v[j][1] < v[i][1] && v[j][2] < v[i][2]){
| ^
main
ソースコード
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>
static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;
template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;
int main() {
int n;
cin >> n;
vector<array<int, 3>> v(n);
for (int i = 0; i < n; ++i) {
for (int j = 0; j < 3; ++j) {
scanf("%d", &v[i][j]);
}
sort(v[i].begin(),v[i].end());
}
sort(v.begin(),v.end());
vector<int> dp(n,1);
for (int i = 0; i < n; ++i) {
for (int j = 0; j < i; ++j) {
if(v[j][0] < v[i][0] && v[j][1] < v[i][1] && v[j][2] < v[i][2]){
dp[i] = max(dp[i], dp[j]+1);
}
}
}
cout << *max_element(dp.begin(),dp.end()) << "\n";
return 0;
}