对比测试
# |
Language |
T1 |
T2 |
T3 |
T4 |
T5 |
T6-1 |
T6-2 |
T6-3 |
T7-1 |
T7-2 |
T8 |
T9-1 |
T9-2 |
LibreOJ(2017.6) |
G++ 5.4.0 (-O2) |
278 |
262 |
732 |
680 |
460 |
|
Codeforces |
G++ 5.1.0 (-O2) |
288 |
295 |
967 |
701 |
857 |
467 |
358 |
77 |
1045 |
5912 |
639 |
530 |
LibreOJ(2017.12.10) |
G++ 5.4.0 (-O2) |
301 |
319 |
823 |
850 |
736 |
|
LibreOJ(2018.3) |
286 |
397 |
1034 |
732 |
646 |
725 |
624 |
79 |
381 |
1058 |
845 |
708 |
587 |
LibreOJ(2017.10) |
304 |
535 |
929 |
1163 |
942 |
|
Luogu |
G++ (-O2,C++11) |
372 |
500 |
964 |
1040 |
- |
684 |
551 |
100 |
378 |
1170 |
928 |
726 |
585 |
UOJ |
G++ 4.8.4 (-O2) |
374 |
525 |
1100 |
1375 |
700 |
821 |
587 |
64 |
417 |
1323 |
889 |
758 |
498 |
UOJ(2017.6) |
435 |
530 |
1377 |
996 |
918 |
|
BZOJ |
G++ 4.4.5 (-O2) |
504 |
1280 |
2092 |
1368 |
1568 |
1752 |
1516 |
180 |
2792 |
2788 |
6288 |
1636 |
1388 |
HUSTOJ(2017.6) |
908 |
1460 |
1413 |
1553 |
- |
L🐟OI Online Judge (2018.10) |
G++ 5.4.0 (-O2) |
439 |
565 |
1121 |
772 |
1196 |
623 |
633 |
136 |
526 |
1637 |
1112 |
975 |
652 |
对照组 MacBook Pro 2015 i5-5257U |
G++ 8.2.0 (-O2) |
338 |
508 |
991 |
1370 |
1509 |
607 |
546 |
148 |
397 |
1229 |
838 |
831 |
649 |
测试内容
测试点 |
内容 |
T1 |
循环 |
T2 |
欧拉筛 |
T3 |
Floyd-Warshall 算法 |
T4 |
std::set |
T5 |
内存申请(new ) |
T6 |
内存访问和缓存 |
T7 |
整数除法和取模 |
T8 |
浮点数运算 |
T9 |
CPU 流水线和循环展开 |
#include<cstdio>
using namespace std;
int main(){
int a=1000000000,b=1;
while(a)b<<=1,a--;
printf("%d\n",b);
return 0;
}
#include<cstdio>
using namespace std;
const int MX=50000000;
int p[MX],m[MX],pc;
int main(){
for(int i=2;i<MX;i++){
if(!m[i])p[++pc]=m[i]=i;
static int k;
for(int j=1;j<=pc&&p[j]<=m[i]&&(k=p[j]*i)<MX;j++)m[k]=p[j];
}
int ans=0;
for(int i=1;i<=pc;i++)ans^=p[i];
printf("%d\n",ans);
return 0;
}
#include<cstdio>
using namespace std;
const int MX=1000;
int G[MX][MX];
int sed=0;
inline int rand(){return sed=(sed*sed*73+sed*233+19260817)&0x0000ffff;}
int main(){
for(int i=0;i<MX;i++)
for(int j=0;j<MX;j++)
G[i][j]=rand();
for(int i=0;i<MX;i++)
for(int j=0;j<MX;j++)
for(int k=0;k<MX;k++)
if(G[j][k]>G[j][i]+G[i][k])G[j][k]=G[j][i]+G[i][k];
int ans=0;
for(int i=0;i<MX;i++)
for(int j=0;j<MX;j++)
ans^=G[i][j];
printf("%d\n",ans);
return 0;
}
#include<cstdio>
#include<algorithm>
#include<set>
using namespace std;
const int MX=1000000;
int sed=0;
inline int rand(){return sed=(sed*sed*73+sed*233+19260817);}
int main(){
set<int>S;
for(int i=0;i<MX;i++)S.insert(rand());
int ans=0;
for(set<int>::iterator it=S.begin();it!=S.end();it++)ans^=*it;
printf("%d\n",ans);
return 0;
}
#include<cstdio>
using namespace std;
const int MX=20000000;
int *it[MX];
int main(){
for(int i=0;i<MX;i++)it[i]=new int;
for(int i=0;i<MX;i++)*it[i]=i;
int ans=0;
for(int i=0;i<MX;i++)ans^=*it[i];
printf("%d\n",ans);
return 0;
}
#include<cstdio>
using namespace std;
const int MX=1<<25;
int a[MX];
inline unsigned int rand(){static unsigned int sed=0;return (sed=(sed*233+19260421))&(MX-1);}
int main(){
for(int i=0;i<MX;i++)a[rand()]=i;
return 0;
}
#include<cstdio>
using namespace std;
const int MX=1<<25;
int a[MX];
inline unsigned int rand(){static unsigned int sed=0;return (sed=(sed*(MX+1)+1025))&(MX-1);}
int main(){
for(int i=0;i<MX;i++)a[rand()]=i;
return 0;
}
#include<cstdio>
using namespace std;
const int MX=1<<25;
int a[MX];
inline unsigned int rand(){static unsigned int sed=0;return (sed=(sed*(MX+1)+1))&(MX-1);}
int main(){
for(int i=0;i<MX;i++)a[rand()]=i;
return 0;
}
#include<cstdio>
using namespace std;
typedef unsigned long long ull;
#define P 1000000007
const int MX=100000000;
int main(){
ull ans=1;
for(int i=1;i<MX;i++)ans=ans*i%P;
printf("%llu\n",ans);
return 0;
}
#include<cstdio>
using namespace std;
typedef unsigned long long ull;
int P=1000000007;
const int MX=100000000;
int main(){
ull ans=1;
for(int i=1;i<MX;i++)ans=ans*i%P;
printf("%llu\n",ans);
return 0;
}
#include<cstdio>
using namespace std;
const int MX=20000000;
int main(){
double ans=0.61234567898765,t=1,s=0;
for(int i=1;i<MX;i++)s+=(t*=ans);
printf("%f\n",s);
return 0;
}
#include<cstdio>
using namespace std;
typedef unsigned int uint;
const int MX=1<<10;
uint a[MX][MX],b[MX][MX];
inline uint rand(){static unsigned int sed=0;return (sed=(sed*233+19260421))&(MX-1);}
int main(){
register int i,j,k;
for(i=0;i<MX;i++)
for(j=0;j<MX;j++)
a[i][j]=rand();
#define A(t) (b[i][k+t]+=a[i][j]*a[j][k+t])
for(i=0;i<MX;i++)
for(j=0;j<MX;j++)
for(k=0;k<MX;k++)
A(0);
#undef A
uint s;
for(i=0;i<MX;i++)
for(j=0;j<MX;j++)
s+=a[i][j];
printf("%u\n",s);
return 0;
}
#include<cstdio>
using namespace std;
typedef unsigned int uint;
const int MX=1<<10;
uint a[MX][MX],b[MX][MX];
inline uint rand(){static unsigned int sed=0;return (sed=(sed*233+19260421))&(MX-1);}
int main(){
register int i,j,k;
for(i=0;i<MX;i++)
for(j=0;j<MX;j++)
a[i][j]=rand();
#define A(t) (b[i][k+t]+=a[i][j]*a[j][k+t])
for(i=0;i<MX;i++)
for(j=0;j<MX;j++)
for(k=0;k<MX;k+=8)
A(0),A(1),A(2),A(3),A(4),A(5),A(6),A(7);
#undef A
uint s;
for(i=0;i<MX;i++)
for(j=0;j<MX;j++)
s+=a[i][j];
printf("%u\n",s);
return 0;
}
感谢 LibreOJ 提供测试代码和各大 Online Judge 的测试结果。
共 2 条回复
资磁
hkstql!!!