結果

問題 No.497 入れ子の箱
コンテスト
ユーザー TangentDay
提出日時 2017-04-06 21:08:52
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 1,213 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 754 ms
コンパイル使用メモリ 112,968 KB
実行使用メモリ 120,808 KB
最終ジャッジ日時 2026-04-01 12:33:09
合計ジャッジ時間 2,080 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 29
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int n;
    cin >> n;
    if (n > 1000) n = 1000;
    cout << n << endl;
    vector<pair<int, P> > a(n);
    REP(i,n){
        cout << i << endl;
        VI x(3);
        REP(i,3) cin >> x[i];
        sort(ALL(x));
        a[i].first = x[0];
        a[i].second.first = x[1];
        a[i].second.second = x[2];
    }
    sort(ALL(a));
    VI dp(n,1);
    FOR(i,1,n-1){
        REP(j,i){
            if (a[i].first > a[j].first && a[i].second.first > a[j].second.first
                && a[i].second.second > a[j].second.second){
                dp[i] = max(dp[i], dp[j] + 1);
            }
        }
    }
    cout << dp[n-1] << endl;

    return 0;
}
0