Diff
checker
テキスト
テキスト
画像
ドキュメント
Excel
フォルダ
Legal
Enterprise
デスクトップ
料金
ログイン
Diffchecker デスクトップのダウンロード
テキスト比較
2 つのテキスト ファイルの違いを見つける
ツール
履歴
ライブエディター
未変更行を折りたたむ
折り返しなし
レイアウト
分割
統合
比較精度
スマート
単語
文字
シンタックスハイライト
構文を選択
無視
テキスト変換
最初の差分へ移動
入力を編集
Diffchecker Desktop
Diffcheckerを実行する最も安全な方法。Diffchecker Desktopアプリを入手:あなたの差分はコンピューターから出ることはありません!
Desktopを入手
Untitled diff
作成日
11 年前
差分は期限切れになりません
クリア
エクスポート
共有
説明
12 削除
行
合計
削除
文字
合計
削除
この機能を引き続き使用するには、アップグレードしてください
Diff
checker
Pro
価格を見る
92 行
すべてコピー
25 追加
行
合計
追加
文字
合計
追加
この機能を引き続き使用するには、アップグレードしてください
Diff
checker
Pro
価格を見る
94 行
すべてコピー
// iostream is too mainstream
// iostream is too mainstream
#include <cstdio>
#include <cstdio>
// bitch please
// bitch please
#include <iostream>
#include <iostream>
#include <vector>
#include <vector>
#include <set>
#include <set>
#include <map>
#include <map>
#include <string>
#include <string>
#include <queue>
#include <queue>
#include <stack>
#include <stack>
#include <algorithm>
#include <algorithm>
#include <cmath>
#include <cmath>
#include <iomanip>
#include <iomanip>
#define dibs reserve
#define dibs reserve
#define OVER9000 1234567890123456780LL
#define OVER9000 1234567890123456780LL
#define patkan 9
#define patkan 9
#define tisic 47
#define tisic 47
#define soclose 1e-10
#define soclose 1e-10
#define pi 3.1415926535898
#define pi 3.1415926535898
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define chocolate win
#define chocolate win
#define ff first
#define ff first
#define ss second
#define ss second
#define abs(x) ((x < 0)?-(x):(x))
#define abs(x) ((x < 0)?-(x):(x))
#define uint unsigned int
#define uint unsigned int
#include <time.h>
#include <time.h>
// mylittlepony
// mylittlepony
using namespace std;
using namespace std;
vector< vector<int> > G;
vector< vector<int> > G;
vector<int> P;
vector<int> P;
vector<bool> vis;
vector<bool> vis;
vector<int> par;
vector<int> par;
vector<int> path;
vector<int> path;
void DFS(int R) {
void DFS(int R) {
vis[R] =true;
vis[R] =true;
ALL_THE(G[R],it) if(!vis[*it]) {
ALL_THE(G[R],it) if(!vis[*it]) {
// cesta R->*it
// cesta R->*it
P[*it] =1-P[*it];
P[*it] =1-P[*it];
path.push_back(*it);
path.push_back(*it);
par[*it] =R;
par[*it] =R;
DFS(*it);
DFS(*it);
// cesta *it->R
// cesta *it->R
path.push_back(R);
path.push_back(R);
P[R] =1-P[R];
P[R] =1-P[R];
// este raz?
// este raz?
if(P[*it] == 1) {
if(P[*it] == 1) {
// cesta R->*it->R
// cesta R->*it->R
path.push_back(*it);
path.push_back(*it);
path.push_back(R);
path.push_back(R);
P[*it] =0;
P[*it] =0;
P[R] =1-P[R];}
P[R] =1-P[R];}
}
}
}
}
int main() {
int main() {
cin.sync_with_stdio(0);
cin.sync_with_stdio(0);
cin.tie(0);
cin.tie(0);
int N,M;
int N,M;
cin >> N >> M;
cin >> N >> M;
G.resize(N);
G.resize(N);
for(int i =0; i < M; i++) {
for(int i =0; i < M; i++) {
int a,b;
int a,b;
cin >> a >> b;
cin >> a >> b;
G[--a].push_back(--b);
G[--a].push_back(--b);
G[b].push_back(a);}
G[b].push_back(a);}
P.resize(N);
P.resize(N);
for(int i =0; i < N; i++) cin >> P[i];
for(int i =0; i < N; i++) cin >> P[i];
vis.resize(N,false);
vis.resize(N,false);
par.resize(N);
par.resize(N);
コピー
コピー済み
コピー
コピー済み
path.push_back(
0
);
for(int i =0; i < N; i++) if(P[i] == 1) {
P[
0
] =
1-P[0]
;
path.push_back(
i
);
DFS(
0
);
P[
i
] =
0
;
if(P[
0
] == 1 && !G[
0
].empty()) {
DFS(
i
);
path.push_back(G[
0
][0]);
if(P[
i
] == 1 && !G[
i
].empty()) {
P[G[
0
][0]] =1;
path.push_back(G[
i
][0]);
path.push_back(
0
);
P[G[
i
][0]] =1;
P[
0
] =0;
path.push_back(
i
);
path.push_back(G[
0
][0]);
P[
i
] =0;
P[G[
0
][0]] =0;}
path.push_back(G[
i
][0]);
P[G[
i
][0]] =0;}
break;}
for(int i =0; i < N; i++) if(P[i] == 1) {
for(int i =0; i < N; i++) if(P[i] == 1) {
cout << "-1\n";
cout << "-1\n";
return 0;}
return 0;}
cout << path.size() << "\n";
cout << path.size() << "\n";
for(uint i =0; i < path.size(); i++) cout << path[i]+1 << ((i+1 == path.size())?"\n":" ");
for(uint i =0; i < path.size(); i++) cout << path[i]+1 << ((i+1 == path.size())?"\n":" ");
return 0;}
return 0;}
// look at my code
// look at my code
// my code is amazing
// my code is amazing
保存された差分
原文
ファイルを開く
// iostream is too mainstream #include <cstdio> // bitch please #include <iostream> #include <vector> #include <set> #include <map> #include <string> #include <queue> #include <stack> #include <algorithm> #include <cmath> #include <iomanip> #define dibs reserve #define OVER9000 1234567890123456780LL #define patkan 9 #define tisic 47 #define soclose 1e-10 #define pi 3.1415926535898 #define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++) #define chocolate win #define ff first #define ss second #define abs(x) ((x < 0)?-(x):(x)) #define uint unsigned int #include <time.h> // mylittlepony using namespace std; vector< vector<int> > G; vector<int> P; vector<bool> vis; vector<int> par; vector<int> path; void DFS(int R) { vis[R] =true; ALL_THE(G[R],it) if(!vis[*it]) { // cesta R->*it P[*it] =1-P[*it]; path.push_back(*it); par[*it] =R; DFS(*it); // cesta *it->R path.push_back(R); P[R] =1-P[R]; // este raz? if(P[*it] == 1) { // cesta R->*it->R path.push_back(*it); path.push_back(R); P[*it] =0; P[R] =1-P[R];} } } int main() { cin.sync_with_stdio(0); cin.tie(0); int N,M; cin >> N >> M; G.resize(N); for(int i =0; i < M; i++) { int a,b; cin >> a >> b; G[--a].push_back(--b); G[b].push_back(a);} P.resize(N); for(int i =0; i < N; i++) cin >> P[i]; vis.resize(N,false); par.resize(N); path.push_back(0); P[0] =1-P[0]; DFS(0); if(P[0] == 1 && !G[0].empty()) { path.push_back(G[0][0]); P[G[0][0]] =1; path.push_back(0); P[0] =0; path.push_back(G[0][0]); P[G[0][0]] =0;} for(int i =0; i < N; i++) if(P[i] == 1) { cout << "-1\n"; return 0;} cout << path.size() << "\n"; for(uint i =0; i < path.size(); i++) cout << path[i]+1 << ((i+1 == path.size())?"\n":" "); return 0;} // look at my code // my code is amazing
変更されたテキスト
ファイルを開く
// iostream is too mainstream #include <cstdio> // bitch please #include <iostream> #include <vector> #include <set> #include <map> #include <string> #include <queue> #include <stack> #include <algorithm> #include <cmath> #include <iomanip> #define dibs reserve #define OVER9000 1234567890123456780LL #define patkan 9 #define tisic 47 #define soclose 1e-10 #define pi 3.1415926535898 #define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++) #define chocolate win #define ff first #define ss second #define abs(x) ((x < 0)?-(x):(x)) #define uint unsigned int #include <time.h> // mylittlepony using namespace std; vector< vector<int> > G; vector<int> P; vector<bool> vis; vector<int> par; vector<int> path; void DFS(int R) { vis[R] =true; ALL_THE(G[R],it) if(!vis[*it]) { // cesta R->*it P[*it] =1-P[*it]; path.push_back(*it); par[*it] =R; DFS(*it); // cesta *it->R path.push_back(R); P[R] =1-P[R]; // este raz? if(P[*it] == 1) { // cesta R->*it->R path.push_back(*it); path.push_back(R); P[*it] =0; P[R] =1-P[R];} } } int main() { cin.sync_with_stdio(0); cin.tie(0); int N,M; cin >> N >> M; G.resize(N); for(int i =0; i < M; i++) { int a,b; cin >> a >> b; G[--a].push_back(--b); G[b].push_back(a);} P.resize(N); for(int i =0; i < N; i++) cin >> P[i]; vis.resize(N,false); par.resize(N); for(int i =0; i < N; i++) if(P[i] == 1) { path.push_back(i); P[i] =0; DFS(i); if(P[i] == 1 && !G[i].empty()) { path.push_back(G[i][0]); P[G[i][0]] =1; path.push_back(i); P[i] =0; path.push_back(G[i][0]); P[G[i][0]] =0;} break;} for(int i =0; i < N; i++) if(P[i] == 1) { cout << "-1\n"; return 0;} cout << path.size() << "\n"; for(uint i =0; i < path.size(); i++) cout << path[i]+1 << ((i+1 == path.size())?"\n":" "); return 0;} // look at my code // my code is amazing
違いを見つける