Diff
checker
टेक्स्ट
टेक्स्ट
छवियां
दस्तावेज़
Excel
फ़ोल्डर्स
Legal
Enterprise
डेस्कटॉप
मूल्य
साइन इन करें
Diffchecker डेस्कटॉप डाउनलोड करें
टेक्स्ट की तुलना करें
दो टेक्स्ट फ़ाइलों के बीच अंतर ढूंढें
उपकरण
इतिहास
रियल-टाइम एडिटर
अपरिवर्तित संक्षिप्त करें
लाइन रैप बंद
लेआउट
विभाजित
संयुक्त
परिवर्तन हाइलाइट करें
स्मार्ट
शब्द
अक्षर
सिंटैक्स हाइलाइटिंग
सिंटैक्स चुनें
अनदेखा करें
टेक्स्ट बदलें
पहले अंतर पर जाएँ
इनपुट संपादित करें
Diffchecker Desktop
Diffchecker चलाने का सबसे सुरक्षित तरीका। Diffchecker Desktop ऐप पाएं: आपके diffs कभी आपके कंप्यूटर से बाहर नहीं जाते!
Desktop पाएं
Untitled diff
बनाया गया
9 वर्ष पहले
Diff कभी समाप्त नहीं होता
साफ़
निर्यात करें
शेयर करें
समझाएं
43 हटाए गए
लाइनें
कुल
हटाया गया
अक्षर
कुल
हटाया गया
इस सुविधा का उपयोग जारी रखने के लिए, अपग्रेड करें
Diff
checker
Pro
मूल्य देखें
157 लाइनें
सभी को कॉपी करें
32 जोड़े गए
लाइनें
कुल
जोड़ा गया
अक्षर
कुल
जोड़ा गया
इस सुविधा का उपयोग जारी रखने के लिए, अपग्रेड करें
Diff
checker
Pro
मूल्य देखें
145 लाइनें
सभी को कॉपी करें
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
#include
<cstdio>
#include
<bits/stdc++.h>
#include <cstring>
#include <algorithm>
#include <queue>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#define maxn 600009
using namespace std;
using namespace std;
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
int
UU
[maxn],
VV
[maxn],
WW
[maxn], q[maxn];
const
int
maxn= 600100;
using namespace std;
int a
[maxn],
b
[maxn],
c
[maxn], q[maxn];
typedef struct
typedef struct
{
{
int l,r;
int l,r;
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
}node
;
}node
1
;
node
seg[maxn];
node
1
seg[maxn];
typedef struct
typedef struct
{
{
int u,v,w,id;
int u,v,w,id;
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
}node
1
;
}node
2
;
node
1
edge[maxn];
node
2
edge[maxn];
bool cmp(node
1
x,node
1
y)
bool cmp(node
2
x,node
2
y)
{
{
return x.w<y.w;
return x.w<y.w;
}
}
int p[maxn];
int p[maxn];
int findset(int x)
int findset(int x)
{
{
return x==p[x]?x:p[x]=findset(p[x]);
return x==p[x]?x:p[x]=findset(p[x]);
}
}
void unionset(int x,int y)
void unionset(int x,int y)
{
{
p[findset(x)]=findset(y);
p[findset(x)]=findset(y);
}
}
int vis[maxn];
int vis[maxn];
bool wa[maxn];
bool wa[maxn];
set<int>st;
set<int>st;
struct Edge
struct Edge
{
{
int to,id;
int to,id;
};
};
vector<Edge>G[maxn];
vector<Edge>G[maxn];
int type[maxn];
int type[maxn];
map<int, int>mp;
map<int, int>mp;
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
vector< vector<int> > V[maxn];
vector< vector<int> > V[maxn];
vector<int>tmp[maxn], cr;
vector<int>tmp[maxn], cr;
vector<int>buf;
vector<int>buf;
bool NO[maxn];
bool NO[maxn];
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
int fdset(int x){
int fdset(int x){
return q[x] == x ? x : q[x] = fdset(q[x]);
return q[x] == x ? x : q[x] = fdset(q[x]);
}
}
void unset(int x, int y){
void unset(int x, int y){
q[fdset(x)] = fdset(y);
q[fdset(x)] = fdset(y);
}
}
void doit(vector <int> &G){
void doit(vector <int> &G){
cr.clear();
cr.clear();
int lb = G[0];
int lb = G[0];
for(int j = 1; j < (int)G.size(); j++){
for(int j = 1; j < (int)G.size(); j++){
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
int u =
UU
[G[j]]
;
int u =
a
[G[j]]
,
v =
b
[G[j]];
int
v =
VV
[G[j]];
u = findset(u);
v = findset(v);
u = findset(u);
v = findset(v);
if(fdset(u) == fdset(v)){
if(fdset(u) == fdset(v)){
NO[lb] = 1;
NO[lb] = 1;
}
}
unset(u, v);
unset(u, v);
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
cr.push_back(u);
cr.push_back(u);
cr.push_back(v);
cr.push_back(v);
if(NO[lb])
break;
if(NO[lb])
break;
}
}
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
for(auto x: cr)
for(auto x: cr)
q[x] = x;
q[x] = x;
}
}
void check(int x){
void check(int x){
for(int i = 0; i < (int)V[x].size(); i++){
for(int i = 0; i < (int)V[x].size(); i++){
doit(V[x][i]);
doit(V[x][i]);
}
}
}
}
int main()
int main()
{
{
int n,m;
int n,m;
scanf("%d%d",&n,&m);
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++){
for(int i=1;i<=n;i++){
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
p[i]=i;
p[i]=i;
q[i] = i;
q[i] = i;
}
}
for(int i=0;i<m;i++)
for(int i=0;i<m;i++)
{
{
scanf("%d%d%d",&edge[i].u,&edge[i].v,&edge[i].w);
scanf("%d%d%d",&edge[i].u,&edge[i].v,&edge[i].w);
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
UU[i +
1] = edge[i].u;
a[i+
1] = edge[i].u;
VV[i +
1] = edge[i].v;
b[i+
1] = edge[i].v;
WW[i +
1] = edge[i].w;
c[i+
1] = edge[i].w;
edge[i].id=i+1;
edge[i].id=i+1;
}
}
sort(edge,edge+m,cmp);
sort(edge,edge+m,cmp);
int cur=0,tot=0;
int cur=0,tot=0;
while(cur<m)
while(cur<m)
{
{
seg[tot].l=cur;
seg[tot].l=cur;
while(cur+1<m&&edge[cur].w==edge[cur+1].w)
while(cur+1<m&&edge[cur].w==edge[cur+1].w)
cur++;
cur++;
seg[tot].r=cur;
seg[tot].r=cur;
mp[edge[cur].w] = tot;
mp[edge[cur].w] = tot;
cur++;tot++;
cur++;tot++;
}
}
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
int
Q
;
int
q
;
scanf("%d", &
Q
);
scanf("%d", &
q
);
for(int i = 1; i <=
Q
; i++){
for(int i = 1; i <=
q
; i++){
buf.clear();
buf.clear();
buf.push_back(i);
buf.push_back(i);
cr.clear();
cr.clear();
int num;
int num;
scanf("%d", &num);
scanf("%d", &num);
for(int j = 0; j < num; j++){
for(int j = 0; j < num; j++){
int x;
int x;
scanf("%d", &x);
scanf("%d", &x);
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
int w = mp[
WW
[x]];
int w = mp[
c
[x]];
if((int)tmp[w].size() == 0){
if((int)tmp[w].size() == 0){
tmp[w].push_back(i);
tmp[w].push_back(i);
tmp[w].push_back(x);
tmp[w].push_back(x);
cr.push_back(w);
cr.push_back(w);
}
}
else{
else{
tmp[w].push_back(x);
tmp[w].push_back(x);
}
}
buf.push_back(x);
buf.push_back(x);
}
}
for(auto x: cr){
for(auto x: cr){
V[x].push_back(tmp[x]);
V[x].push_back(tmp[x]);
tmp[x].clear();
tmp[x].clear();
}
}
doit(buf);
doit(buf);
}
}
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
//cout << tot << endl;
for(int i=0;i<tot;i++)
for(int i=0;i<tot;i++)
{
{
check(i);
check(i);
for(int j = seg[i].l; j <= seg[i].r; j++){
for(int j = seg[i].l; j <= seg[i].r; j++){
unionset(edge[j].u, edge[j].v);
unionset(edge[j].u, edge[j].v);
}
}
}
}
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
for(int i = 1; i <=
Q
; i++)
for(int i = 1; i <=
q
; i++)
if(NO[i])
{
if(NO[i])
{
puts("NO");
puts("NO");
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
else
}
else
{
puts("YES");
puts("YES");
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
}
}
return 0;
return 0;
}
}
सेव किए गए Diffs
ऑरिजनल टेक्स्ट
फ़ाइल खोलें
#include <cstdio> #include <cstring> #include <algorithm> #include <queue> #include <iostream> #include <vector> #include <map> #include <set> #define maxn 600009 using namespace std; int UU[maxn], VV[maxn], WW[maxn], q[maxn]; typedef struct { int l,r; }node; node seg[maxn]; typedef struct { int u,v,w,id; }node1; node1 edge[maxn]; bool cmp(node1 x,node1 y) { return x.w<y.w; } int p[maxn]; int findset(int x) { return x==p[x]?x:p[x]=findset(p[x]); } void unionset(int x,int y) { p[findset(x)]=findset(y); } int vis[maxn]; bool wa[maxn]; set<int>st; struct Edge { int to,id; }; vector<Edge>G[maxn]; int type[maxn]; map<int, int>mp; vector< vector<int> > V[maxn]; vector<int>tmp[maxn], cr; vector<int>buf; bool NO[maxn]; int fdset(int x){ return q[x] == x ? x : q[x] = fdset(q[x]); } void unset(int x, int y){ q[fdset(x)] = fdset(y); } void doit(vector <int> &G){ cr.clear(); int lb = G[0]; for(int j = 1; j < (int)G.size(); j++){ int u = UU[G[j]]; int v = VV[G[j]]; u = findset(u); v = findset(v); if(fdset(u) == fdset(v)){ NO[lb] = 1; } unset(u, v); cr.push_back(u); cr.push_back(v); if(NO[lb]) break; } for(auto x: cr) q[x] = x; } void check(int x){ for(int i = 0; i < (int)V[x].size(); i++){ doit(V[x][i]); } } int main() { int n,m; scanf("%d%d",&n,&m); for(int i=1;i<=n;i++){ p[i]=i; q[i] = i; } for(int i=0;i<m;i++) { scanf("%d%d%d",&edge[i].u,&edge[i].v,&edge[i].w); UU[i + 1] = edge[i].u; VV[i + 1] = edge[i].v; WW[i + 1] = edge[i].w; edge[i].id=i+1; } sort(edge,edge+m,cmp); int cur=0,tot=0; while(cur<m) { seg[tot].l=cur; while(cur+1<m&&edge[cur].w==edge[cur+1].w) cur++; seg[tot].r=cur; mp[edge[cur].w] = tot; cur++;tot++; } int Q; scanf("%d", &Q); for(int i = 1; i <= Q; i++){ buf.clear(); buf.push_back(i); cr.clear(); int num; scanf("%d", &num); for(int j = 0; j < num; j++){ int x; scanf("%d", &x); int w = mp[WW[x]]; if((int)tmp[w].size() == 0){ tmp[w].push_back(i); tmp[w].push_back(x); cr.push_back(w); } else{ tmp[w].push_back(x); } buf.push_back(x); } for(auto x: cr){ V[x].push_back(tmp[x]); tmp[x].clear(); } doit(buf); } //cout << tot << endl; for(int i=0;i<tot;i++) { check(i); for(int j = seg[i].l; j <= seg[i].r; j++){ unionset(edge[j].u, edge[j].v); } } for(int i = 1; i <= Q; i++) if(NO[i]) puts("NO"); else puts("YES"); return 0; }
परिवर्तित टेक्स्ट
फ़ाइल खोलें
#include<bits/stdc++.h> using namespace std; const int maxn= 600100; using namespace std; int a[maxn], b[maxn], c[maxn], q[maxn]; typedef struct { int l,r; }node1; node1 seg[maxn]; typedef struct { int u,v,w,id; }node2; node2 edge[maxn]; bool cmp(node2 x,node2 y) { return x.w<y.w; } int p[maxn]; int findset(int x) { return x==p[x]?x:p[x]=findset(p[x]); } void unionset(int x,int y) { p[findset(x)]=findset(y); } int vis[maxn]; bool wa[maxn]; set<int>st; struct Edge { int to,id; }; vector<Edge>G[maxn]; int type[maxn]; map<int, int>mp; vector< vector<int> > V[maxn]; vector<int>tmp[maxn], cr; vector<int>buf; bool NO[maxn]; int fdset(int x){ return q[x] == x ? x : q[x] = fdset(q[x]); } void unset(int x, int y){ q[fdset(x)] = fdset(y); } void doit(vector <int> &G){ cr.clear(); int lb = G[0]; for(int j = 1; j < (int)G.size(); j++){ int u = a[G[j]], v = b[G[j]]; u = findset(u);v = findset(v); if(fdset(u) == fdset(v)){ NO[lb] = 1; } unset(u, v); cr.push_back(u);cr.push_back(v); if(NO[lb])break; } for(auto x: cr)q[x] = x; } void check(int x){ for(int i = 0; i < (int)V[x].size(); i++){ doit(V[x][i]); } } int main() { int n,m; scanf("%d%d",&n,&m); for(int i=1;i<=n;i++){ p[i]=i;q[i] = i; } for(int i=0;i<m;i++) { scanf("%d%d%d",&edge[i].u,&edge[i].v,&edge[i].w); a[i+1] = edge[i].u; b[i+1] = edge[i].v; c[i+1] = edge[i].w; edge[i].id=i+1; } sort(edge,edge+m,cmp); int cur=0,tot=0; while(cur<m) { seg[tot].l=cur; while(cur+1<m&&edge[cur].w==edge[cur+1].w) cur++; seg[tot].r=cur; mp[edge[cur].w] = tot; cur++;tot++; } int q; scanf("%d", &q); for(int i = 1; i <= q; i++){ buf.clear();buf.push_back(i); cr.clear(); int num; scanf("%d", &num); for(int j = 0; j < num; j++){ int x; scanf("%d", &x); int w = mp[c[x]]; if((int)tmp[w].size() == 0){ tmp[w].push_back(i); tmp[w].push_back(x); cr.push_back(w); } else{ tmp[w].push_back(x); } buf.push_back(x); } for(auto x: cr){ V[x].push_back(tmp[x]); tmp[x].clear(); } doit(buf); } for(int i=0;i<tot;i++) { check(i); for(int j = seg[i].l; j <= seg[i].r; j++){ unionset(edge[j].u, edge[j].v); } } for(int i = 1; i <= q; i++) { if(NO[i]){ puts("NO"); } else{ puts("YES"); } } return 0; }
अंतर खोजें