結果

問題 No.1605 Matrix Shape
ユーザー aut_jul_duraut_jul_dur
提出日時 2021-07-16 22:09:15
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 959 bytes
コンパイル時間 3,589 ms
コンパイル使用メモリ 225,908 KB
実行使用メモリ 6,788 KB
最終ジャッジ日時 2023-09-20 14:12:45
合計ジャッジ時間 7,159 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
6,448 KB
testcase_01 AC 3 ms
6,452 KB
testcase_02 AC 3 ms
6,520 KB
testcase_03 AC 3 ms
6,508 KB
testcase_04 WA -
testcase_05 AC 4 ms
6,456 KB
testcase_06 AC 4 ms
6,456 KB
testcase_07 AC 3 ms
6,540 KB
testcase_08 AC 3 ms
6,452 KB
testcase_09 AC 3 ms
6,520 KB
testcase_10 AC 4 ms
6,720 KB
testcase_11 WA -
testcase_12 AC 4 ms
6,596 KB
testcase_13 AC 3 ms
6,460 KB
testcase_14 AC 3 ms
6,720 KB
testcase_15 AC 3 ms
6,508 KB
testcase_16 AC 3 ms
6,520 KB
testcase_17 AC 3 ms
6,448 KB
testcase_18 AC 3 ms
6,512 KB
testcase_19 AC 125 ms
6,444 KB
testcase_20 AC 113 ms
6,460 KB
testcase_21 AC 112 ms
6,584 KB
testcase_22 WA -
testcase_23 AC 126 ms
6,508 KB
testcase_24 AC 129 ms
6,516 KB
testcase_25 AC 77 ms
6,456 KB
testcase_26 AC 77 ms
6,452 KB
testcase_27 AC 78 ms
6,788 KB
testcase_28 WA -
testcase_29 AC 77 ms
6,588 KB
testcase_30 AC 111 ms
6,648 KB
testcase_31 AC 112 ms
6,728 KB
testcase_32 AC 106 ms
6,456 KB
testcase_33 WA -
testcase_34 AC 103 ms
6,452 KB
testcase_35 AC 101 ms
6,596 KB
testcase_36 AC 59 ms
6,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const long long MOD = 1000000007;
const long long INF = 9999999999999999;
using ll = long long;
using mint = modint1000000007;
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; }
int main(){
  ll N;
  cin>>N;
  ll H[200200] = {};
  ll W[200200] = {};
  rep(i,N){
    ll a,b;
    cin>>a>>b;
    H[a]++;
    W[b]++;
  }
  ll d = 0;
  ll tigau = 0;
  rep(i,200200){
    if(H[i] != W[i]){
      tigau++;
    }
  }
  if(tigau > 2){
    cout << 0 << endl;
  }
  else if(tigau == 0){
    ll ans = 0;
    rep(i,200200){
      if(H[i]>0){
        ans++;
      }
    }
    cout << ans << endl;
  }
  else if(tigau == 2){
    cout << 1 << endl;
  }
  return 0;
}
0