結果
問題 | No.1605 Matrix Shape |
ユーザー | Nzt3 |
提出日時 | 2021-07-16 23:22:07 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 649 bytes |
コンパイル時間 | 2,007 ms |
コンパイル使用メモリ | 176,576 KB |
実行使用メモリ | 5,744 KB |
最終ジャッジ日時 | 2023-09-20 15:52:25 |
合計ジャッジ時間 | 5,770 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 5 ms
4,376 KB |
testcase_01 | AC | 5 ms
4,376 KB |
testcase_02 | AC | 6 ms
4,376 KB |
testcase_03 | AC | 5 ms
4,380 KB |
testcase_04 | WA | - |
testcase_05 | AC | 5 ms
4,376 KB |
testcase_06 | AC | 5 ms
4,376 KB |
testcase_07 | AC | 5 ms
4,380 KB |
testcase_08 | WA | - |
testcase_09 | AC | 6 ms
4,380 KB |
testcase_10 | AC | 5 ms
4,376 KB |
testcase_11 | AC | 5 ms
4,380 KB |
testcase_12 | WA | - |
testcase_13 | AC | 6 ms
4,376 KB |
testcase_14 | AC | 5 ms
4,376 KB |
testcase_15 | AC | 5 ms
4,376 KB |
testcase_16 | AC | 6 ms
4,376 KB |
testcase_17 | AC | 5 ms
4,376 KB |
testcase_18 | AC | 5 ms
4,380 KB |
testcase_19 | AC | 139 ms
5,432 KB |
testcase_20 | WA | - |
testcase_21 | AC | 107 ms
5,468 KB |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | AC | 115 ms
5,368 KB |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | AC | 78 ms
5,548 KB |
testcase_28 | WA | - |
testcase_29 | AC | 78 ms
5,468 KB |
testcase_30 | WA | - |
testcase_31 | AC | 108 ms
5,324 KB |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | AC | 116 ms
5,312 KB |
testcase_35 | AC | 92 ms
5,232 KB |
testcase_36 | AC | 57 ms
4,696 KB |
ソースコード
#include<bits/stdc++.h> using namespace std; const int mod=1e9+7; int main(){ int N; cin>>N; vector<int>cnt(200000); vector<array<int,2>>E(N); for(int i=0;i<N;i++){ cin>>E[i][0]>>E[i][1]; E[i][0]--,E[i][1]--; cnt[E[i][0]]++; cnt[E[i][1]]--; } long long ans=0; bool cycle=false; sort(cnt.begin(),cnt.end()); if(cnt[0]==0&&cnt[200000-1]==0)cycle=true; if(cnt[0]==-1&&cnt[200000-1]==1){ ans=1; for(int i=1;i<N-1;i++){ if(cnt[i]!=0)ans=0; } } if(cycle){ sort(E.begin(),E.end()); E.erase(unique(E.begin(),E.end()),E.end()); cout<<E.size()<<'\n'; }else{ cout<<ans<<'\n'; } }