結果

問題 No.1605 Matrix Shape
ユーザー 夜
提出日時 2021-07-16 22:02:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 801 bytes
コンパイル時間 2,405 ms
コンパイル使用メモリ 97,496 KB
実行使用メモリ 14,436 KB
最終ジャッジ日時 2023-09-20 13:57:00
合計ジャッジ時間 7,755 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 238 ms
14,116 KB
testcase_20 AC 183 ms
8,652 KB
testcase_21 AC 184 ms
8,724 KB
testcase_22 WA -
testcase_23 AC 242 ms
14,436 KB
testcase_24 AC 259 ms
14,396 KB
testcase_25 AC 86 ms
4,380 KB
testcase_26 AC 86 ms
4,376 KB
testcase_27 AC 86 ms
4,376 KB
testcase_28 WA -
testcase_29 AC 86 ms
4,380 KB
testcase_30 AC 197 ms
8,700 KB
testcase_31 AC 179 ms
8,648 KB
testcase_32 AC 152 ms
5,920 KB
testcase_33 WA -
testcase_34 AC 101 ms
4,376 KB
testcase_35 AC 183 ms
12,072 KB
testcase_36 AC 93 ms
8,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int l[200020] = {}, r[200020] = {};
set<int> st;
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int h, w;
		cin >> h >> w;
		st.insert(h);
		if (r[h] == 0) {
			l[h]++;
		}
		else {
			r[h]--;
		}
		if (l[w] == 0) {
			r[w]++;
		}
		else {
			l[w]--;
		}
	}
	int l1 = 0, r1 = 0;
	for (int i = 1; i <= 200000; i++) {
		l1 += l[i];
		r1 += r[i];
	}
	if (l1 == 0 && r1 == 0) {
		cout << st.size() << endl;
	}
	else if (l1 == 1 && r1 == 1) {
		cout << 1 << endl;
	}
	else {
		cout << 0 << endl;
	}
}
0