結果
| 問題 |
No.1640 簡単な色塗り
|
| コンテスト | |
| ユーザー |
harurun
|
| 提出日時 | 2021-06-16 11:26:26 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,443 bytes |
| コンパイル時間 | 1,044 ms |
| コンパイル使用メモリ | 96,952 KB |
| 最終ジャッジ日時 | 2025-01-22 08:31:19 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 21 WA * 27 RE * 2 TLE * 3 |
ソースコード
//時間計測用
//構築未実装
#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;
}
harurun