結果

問題 No.497 入れ子の箱
コンテスト
ユーザー fine
提出日時 2017-03-24 23:03:35
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 571 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,303 ms
コンパイル使用メモリ 192,200 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-03-27 09:18:32
合計ジャッジ時間 2,202 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>

using namespace std;

typedef tuple<int, int, int> T;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<T> b(n);
	for (int i = 0; i < n; i++) {
		int d[3];
		for (int j = 0; j < 3; j++) cin >> d[j];
		sort(d, d + 3);
		b[i] = tie(d[0], d[1], d[2]);
	}
	sort(b.begin(), b.end());
	int ans = 0;
	int px = 0, py = 0, pz = 0;
	for (int i = 0; i < n; i++) {
		int x, y, z;
		tie(x, y, z) = b[i];
		if (px < x && py < y && pz < z) {
			ans++;
			px = x;
			py = y;
			pz = z;
		}
	}
	cout << ans << endl;
	return 0;
}
0