結果

問題 No.497 入れ子の箱
ユーザー nanophoto12nanophoto12
提出日時 2017-08-19 00:54:23
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 6 ms / 5,000 ms
コード長 1,373 bytes
コンパイル時間 1,230 ms
コンパイル使用メモリ 108,464 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-22 15:56:22
合計ジャッジ時間 2,145 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 4 ms
5,376 KB
testcase_04 AC 4 ms
5,376 KB
testcase_05 AC 5 ms
5,376 KB
testcase_06 AC 5 ms
5,376 KB
testcase_07 AC 5 ms
5,376 KB
testcase_08 AC 5 ms
5,376 KB
testcase_09 AC 4 ms
5,376 KB
testcase_10 AC 5 ms
5,376 KB
testcase_11 AC 4 ms
5,376 KB
testcase_12 AC 6 ms
5,376 KB
testcase_13 AC 5 ms
5,376 KB
testcase_14 AC 5 ms
5,376 KB
testcase_15 AC 5 ms
5,376 KB
testcase_16 AC 5 ms
5,376 KB
testcase_17 AC 6 ms
5,376 KB
testcase_18 AC 4 ms
5,376 KB
testcase_19 AC 4 ms
5,376 KB
testcase_20 AC 5 ms
5,376 KB
testcase_21 AC 4 ms
5,376 KB
testcase_22 AC 4 ms
5,376 KB
testcase_23 AC 3 ms
5,376 KB
testcase_24 AC 3 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 5 ms
5,376 KB
testcase_28 AC 5 ms
5,376 KB
testcase_29 AC 5 ms
5,376 KB
testcase_30 AC 4 ms
5,376 KB
testcase_31 AC 4 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cmath>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <functional>
#include <queue>
#include <iostream>
#include <string.h>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstdint>
#include <climits>
#include <unordered_set>
#include <sstream>
#include <stack>

using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> t3;

using namespace std;

bool contains(t3 parent, t3 child)
{
    ll x1,y1,z1;
    tie(x1,y1,z1) = parent;
    ll x2,y2,z2;
    tie(x2,y2,z2) = child;
    return x1 > x2 && y1 > y2 && z1 > z2;
}

int main(){
    int n;
    cin >> n;
    vector<t3> v(n);
    vector<int> c;
    c.assign(n, 1);
    for(int i = 0;i < n;i++)
    {
        vector<ll> a(3);
        cin >> a[0] >> a[1] >> a[2];
        sort(a.begin(), a.end());
        v[i] = make_tuple(a[0], a[1], a[2]);
    }
    sort(v.begin(), v.end());
    int maxCount = 0;
    for(int i = 0;i < n;i++)
    {
        int count = 0;
        for(int j = 0;j < n;j++)
        {
            if(i == j)
            {
                continue;
            }
            if(contains(v[i], v[j]))
            {
                count = max(count, c[j]);
            }
        }
        c[i] = max(c[i], count + 1);
        maxCount = max(maxCount, c[i]);
    }
    cout << maxCount << endl;
    return 0;
}
0