結果

問題 No.1640 簡単な色塗り
ユーザー harurunharurun
提出日時 2021-06-16 11:26:26
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,443 bytes
コンパイル時間 1,172 ms
コンパイル使用メモリ 94,468 KB
実行使用メモリ 42,316 KB
最終ジャッジ日時 2023-09-12 01:26:29
合計ジャッジ時間 13,034 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 5 ms
9,476 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 5 ms
9,292 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 62 ms
13,520 KB
testcase_31 TLE -
testcase_32 AC 1,365 ms
34,456 KB
testcase_33 AC 608 ms
25,580 KB
testcase_34 AC 970 ms
31,328 KB
testcase_35 AC 599 ms
27,696 KB
testcase_36 AC 62 ms
13,440 KB
testcase_37 AC 101 ms
15,624 KB
testcase_38 AC 1,560 ms
35,388 KB
testcase_39 AC 265 ms
20,480 KB
testcase_40 AC 277 ms
20,760 KB
testcase_41 AC 1,051 ms
33,552 KB
testcase_42 AC 357 ms
23,192 KB
testcase_43 AC 366 ms
25,584 KB
testcase_44 AC 339 ms
23,768 KB
testcase_45 AC 226 ms
21,668 KB
testcase_46 AC 75 ms
15,176 KB
testcase_47 AC 41 ms
12,656 KB
testcase_48 AC 1,675 ms
34,404 KB
testcase_49 AC 17 ms
11,000 KB
testcase_50 AC 5 ms
9,408 KB
testcase_51 WA -
testcase_52 TLE -
testcase_53 TLE -
07_evil_01.txt RE -
07_evil_02.txt RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

//時間計測用
//構築未実装
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <assert.h>
#include <stdlib.h>
#include <memory.h>
#include <queue>
#include <time.h>
#include <chrono>
#include <sys/time.h>
#include <atcoder/maxflow>
using namespace std;
using namespace atcoder;
#define ll long long
#define INF 1000000000000000000
using std::cout; using std::endl;
using std::chrono::duration_cast;
using std::chrono::milliseconds;
using std::chrono::seconds;
using std::chrono::system_clock;


int main(){
  auto start = duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
  ll N,A,B;
  cin>>N;
  //Dinic F(200002);
  //Dinic F;
  //cout<<"INF:"<<F.INF<<endl;
  mf_graph<ll> F(200010);
  for(int i=0;i<N;i++){
    //cerr<<i<<endl;
    cin>>A>>B;
    A--;B--;
    /*
    F.add_edge(200000,i,1);
    F.add_edge(i,100000+A,1);
    if(A!=B)F.add_edge(i,100000+B,1);
    F.add_edge(100000+i,200001,1);
    */
    F.add_edge(200000,i,1);
    F.add_edge(i,100000+A,1);
    if(A!=B)F.add_edge(i,100000+B,1);
    F.add_edge(100000+i,200001,1);
  }
  //cerr<<"edge added\n";
  //ll cnt=F.max_flow(200000,200001);
  ll cnt=F.flow(200000,200001);
  //cout<<cnt<<endl;
  if(cnt!=N){
    cout<<"No\n";
    return 0;
  }
  //ここから構築
  cout<<"Yes\n";
  auto end= duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
  cerr<<end-start<<endl;
  return 0;
}
0