結果

問題 No.416 旅行会社
ユーザー vjudge1
提出日時 2025-02-22 16:49:26
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 2,532 bytes
コンパイル時間 1,979 ms
コンパイル使用メモリ 196,500 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2025-02-22 16:49:34
合計ジャッジ時間 6,506 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 7 RE * 14
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:61:14: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=]
   61 |     printf("%d\n",ans);
      |             ~^    ~~~
      |              |    |
      |              int  long long int
      |             %lld

ソースコード

diff #

#include<bits/stdc++.h>
#define int long long
#define MAXN 3005
using namespace std;

inline int read(){
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=x*10+ch-48;
		ch=getchar();
	}
	return x*f;
}

struct boxes{
    int x,y,z;
}box[MAXN<<1];

int f[MAXN<<1];

bool cmp(boxes a,boxes b){
	if(a.x!=b.x) return a.x<b.x;
    if(a.y!=b.y) return a.y<b.y;
    return a.z<b.z;
}

signed main(){
//	freopen("box.in","r",stdin);
//	freopen("box.out","w",stdout);
	int n;
    n=read();
    int tot=0;
    for(int i=1;i<=n;i++){
        int x,y,z;
        x=read();y=read();z=read();
        box[tot++]={x,y,z};
        box[tot++]={x,z,y};
        box[tot++]={y,x,z};
        box[tot++]={y,z,x};
        box[tot++]={z,x,y};
        box[tot++]={z,y,x};
    }
    sort(box,box+tot,cmp);
    int ans=0;
    for(int i=0;i<tot;i++){
        f[i]=1;
        for(int j=0;j<i;j++){
            if(box[j].x<box[i].x && box[j].y<box[i].y && box[j].z<box[i].z){
                f[i]=max(f[i],f[j]+1);
                //f[i] ???? i ????????????????
				//?????? i??????????? j??? j ???? i ?????? f[i]?
            }
        }
        ans=max(ans,f[i]);
    }
    printf("%d\n",ans);
	return 0;
}

/*??
??????
???????????????????????
????????????????????
???????????5???????????????????????????????????????????????????????????????????????????????????????????????24?????????????????????????????????????????????????????????????????????
????????????????????
???????????????????????????????????????????????????????????????????????????????????????????...?????????????
?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...????????????????????????????????
??????????????
????????????
?????????????
?????????????
?????????
??? ? ?? ? ???????
???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?????????????????????????????????????????????????????????????????????????????????????????????????????????????????
???????????????????????????
?????????????????????
????????????????????
?????????????
????????????????
????????????????????????
?????????????????????????
??????
??????????????
????????????
???????????????????
????????????
??????
?????
???????????
??????????????
?????
?????
?????
??????
???????????????
??????????
??????????????
????????????
????*/
0