蒟蒻求救,这个代码哪里错了

P1177 【模板】排序

LZ确定你写的东西我们能看懂?
by LaWekokomidy @ 2018-11-06 16:15:45


那,那,还有那
by Viston @ 2018-11-06 16:15:46


我觉得你的变量名起的稍微复杂了那么一点点
by Mirastar @ 2018-11-06 16:16:52


```cpp #include<iostream> #include<cstring> #include<cstdio> const int maxn=1e5+10; using namespace std; struct Node{ int b[maxn]; int c; void m(int val){ c++; b[c]=val; int d=c; while(d>1){ if(b[d]<b[d>>1]) swap(b[d],b[d>>1]),d>>=1; else break; } } int n(){ int e=b[1]; swap(b[1],b[c]); c--; int f=1; while((f<<1)<=c){ int g; if((f<<1)==c||b[f<<1]<b[f<<1|1]) g=f<<1; else g=f<<1|1; if(b[f]>b[g]) swap(b[f],b[g]),f=g; else break; } return e; } }node; int a; int main(){ int n; scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&a),node.m(a); for(int i=1;i<=n;i++) printf("%d ",node.n()); } ``` 帮楼主改了下变量名,清爽多了 ~~应该不会CE吧~~
by LaWekokomidy @ 2018-11-06 16:20:39


@[Harry_bh](/space/show?uid=19951) 你什么编译器?~~这种代码都能编译肯定很好~~
by 引领天下 @ 2018-11-06 16:24:29


活生生把C++写的比bf还抽象XD
by Hono @ 2018-11-06 16:25:00


```cpp #include<iostream> #include<cstring> #include<cstdio> const int maxn=1e5+10; using namespace std; struct _ { int __[maxn]; int ___; void ____(int val) { ___++; __[___]=val; int _____=___; while(_____>1) { if(__[_____]<__[_____>>1]) swap(__[_____],__[_____>>1]),_____>>=1; else break; } } int ______() { int _______=__[1]; swap(__[1],__[___]); ___--; int ________=1; while((________<<1)<=___) { int _________; if((________<<1)==___||__[________<<1]<__[________<<1|1]) _________=________<<1; else _________=________<<1|1; if(__[________]>__[_________]) swap(__[________],__[_________]),________=_________; else break; } return _______; } }__________; int a; int main() { int n; scanf("%d",&n); for(int i=1;i<=n;i++)scanf("%d",&a),__________.____(a); for(int i=1;i<=n;i++)printf("%d ",__________.______()); } ```
by 137_345_2814 @ 2018-11-06 16:25:03


真好
by Smoggy @ 2018-11-06 16:26:21


@[137_345_2814](/space/show?uid=27329) 这不是codeforces专用码风吗
by Everlasting_Snow @ 2018-11-06 16:26:37


@[引领天下](/space/show?uid=39863) Dev啊
by Reaepita @ 2018-11-06 16:31:42


| 下一页