結果

問題 No.497 入れ子の箱
ユーザー recososorecososo
提出日時 2020-06-14 15:11:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,330 bytes
コンパイル時間 1,722 ms
コンパイル使用メモリ 177,408 KB
実行使用メモリ 8,752 KB
最終ジャッジ日時 2023-09-09 17:56:10
合計ジャッジ時間 8,998 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,n) for (int i = 0; i < (n); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin >> n;
    vector<vector<int>> e(n);
    vector<vector<int>> d(n,vector<int>(3));
    int ans=0;
    rep(i,n){
        rep(j,3){
            cin >> d[i][j];
        }
        sort(d[i].begin(),d[i].end());
    }
    rep(i,n){
        rep(j,n){
            if(d[i][0]<d[j][0]&&d[i][1]<d[j][1]&&d[i][2]<d[j][2]){
                e[i].push_back(j);
            }
        }
    }
    rep(i,n){
        queue<int> q;
        q.push(i);
        vector<int> d(n,1);
        while(!q.empty()){
            int p=q.front();
            q.pop();
            for(int x:e[p]){
                if(chmax(d[x],d[p]+1)){
                    q.push(x);
                }
            }
        }
        int res=0;
        rep(j,n){
            chmax(res,d[j]);
        }
        chmax(ans,res);
    }
    cout << ans << endl;
}
0