版本比较
题解:AT_jsc2019_qual_e Card Collector
正文
增加 8 行删除 8 行
20 行未改动2122232425252627282911 行未改动4142434445454647474849505119 行未改动7172737475757677787942 行未改动12212312412512612612712812913013113113213313413513513613713813914 行未改动15415515615715815815916020 行未改动 static char obuf[IOSIZE], *p3 = obuf;#ifdef ONLINE_JUDGE static char ibuf[IOSIZE], *p1 = ibuf, *p2 = ibuf;#define getchar() ((p1==p2)and(p2=(p1=ibuf)+fread(ibuf,1,IOSIZE,stdin),p1==p2)?(EOF):(*p1++))#endif #endif#define putchar(x) ((p3==obuf+IOSIZE)&&(fwrite(obuf,p3-obuf,1,stdout),p3=obuf),*p3++=x)#define isdigit(ch) (ch>47&&ch<58)#define isspace(ch) (ch<33) template<typename T> static inline T read() { T s = 0; int w = 1; char ch; while (ch = getchar(), !isdigit(ch) and (ch != EOF)) if (ch == '-') w = -1; if (ch == EOF) return false; while (isdigit(ch)) s = s * 10 + ch - 48, ch = getchar(); return s * w; }11 行未改动 static inline bool read(double &x) { char ch = getchar(); int f = 1; for(; (ch<48 or 57<ch) and (ch != EOF); ch=getchar()) if(ch == '-') f = -1; if(ch == EOF) return false; for(x=0; 47<ch and ch<58; ch=getchar()) x = x*10 + (ch^48); if(ch != '.') return x *= f, true; double y = 0.1; for(ch=getchar(); 47<ch and ch<58; ch=getchar()) x += y*(ch^48), y /= 10; return x *= f, true; } static inline void print(double x) { if(x < 0) putchar('-'), x = -x; if(!precision) print((unsigned long long)(x-(unsigned long long)(x)>=0.5 ?x+1 :x)); else { unsigned long long xx = x; double y = ((x-xx)*POW[precision]); unsigned long long yy = (y-(unsigned long long)(y)>=0.5 ?y+1 :y); if(yy == POW[precision]) xx++, yy = 0; print(xx), putchar('.'); for(int j=precision-1; ~j; j--) putchar(48+yy/POW[j]%10); } } template<typename T, typename... T1> static inline int read(T& a, T1&... other) { return read(a) + read(other...); } template<typename T, typename... T1> static inline void print(T a, T1... other) { print(a), print(other...); } static struct Fast_IO { static struct Fast_IO { bool flag = 1; inline ~Fast_IO() { fwrite(obuf, p3 - obuf, 1, stdout); } inline ~Fast_IO() { fwrite(obuf, p3 - obuf, 1, stdout); } inline void SetPrecision(int x) { if(x > 9) throw runtime_error("Precision too high!"); else if(x < 0) throw runtime_error("Precision too low!"); else precision = x; } // 浮点数精度设为 x,即精确到小数点后 x 位。 inline operator bool() { return flag; } } io; template<typename T> static Fast_IO& operator >> (Fast_IO &io, T &b) { return io.flag &= read(b), io; }19 行未改动 inline bool cmp(node x,node y){return x.w>y.w;} int vis[maxm],ban[maxm],fa[maxm<<1]; int pi[maxm<<1]; vector<node>ha[maxm],li[maxm]; priority_queue<node>tmp[maxm<<1];//换成懒惰删除的堆 priority_queue<node>tmp[maxm<<1];//换成懒惰删除的堆 inline node Get(priority_queue<node>&q){ while(q.size()){ int id=q.top().i; if(ban[id]){q.pop();continue;}42 行未改动 node p=ha[i][0]; int id=p.i;vis[id]=1; } } for(int i=1;i<=n+m;i++)fa[i]=i; for(int i=1;i<=n+m;i++)fa[i]=i; for(int i=1;i<=m;i++){ int f=Getfa(i+n); node p=Getli(i);int id=p.i; if(id)tmp[f].push({id,a[id].w}); while(1){//一直寻找 while(1){//一直寻找 node p=Get(tmp[f]); int i=p.i,x=a[i].x,y=a[i].y; if(!i)break; if(!vis[i]){//没有选过该点,好 if(!vis[i]){//没有选过该点,好 vis[i]=1; break; } Mer(x,y+n);f=Getfa(f);14 行未改动// freopen("oblivious5_3.in","r",stdin); freopen("oblivious.in","r",stdin); freopen("oblivious.out","w",stdout); Sasuke::main();//while(1); return 0; return 0;}```