OJ | language | T1 | T2 | T3 | T4 | T5 | T6-1 | T6-2 | T6-3 | T7-1 | T7-2 | T8 | T9-1 | T9-2 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Wyoj | C++ | 338 | 388 | 1324 | 810 | 644 | 712 | 597 | 53 | 1442 | 1450 | 906 | 726 | 644 |
Wyoj | C++11 | 334 | 378 | 1370 | 792 | 622 | 706 | 357 | 53 | 392 | 1170 | 899 | 747 | 649 |
洛谷 | G++(-O2,C++14) | 372 | 500 | 964 | 1040 | 786 | 684 | 551 | 100 | 378 | 1170 | 928 | 726 | 585 |
Atcoder | GCC12.2(C++20) | 309 | 336 | 769 | 697 | 612 | 356 | 398 | 67 | 359 | 603 | 682 | 137 | 159 |
Codeforces | G++ 5.1.0(-O2) | 288 | 295 | 967 | 701 | 857 | 467 | 358 | 77 | 1045 | 1045 | 5912 | 639 | 530 |
UOJ | G++ 4.8.4 (-O2) | 374 | 525 | 1100 | 1375 | 700 | 821 | 587 | 64 | 417 | 1323 | 889 | 758 | 498 |
LibreOJ | G++ 8.2.0(-O2,C++14) | 246 | 310 | 598 | 586 | 418 | 474 | 396 | 55 | 282 | 604 | 27 | 519 | 272 |
BZOJ | G++ 4.4.5(-O2) | 504 | 1280 | 2092 | 1368 | 1568 | 1752 | 1516 | 180 | 2792 | 2788 | 6288 | 1636 | 1388 |
总结:本OJ C++在“整数除法与取模”方面慢于C++11,其余都差不多。Wyoj在评测机中属于中等水平。
测试方面:
测试点 | 内容 |
---|---|
T1 | 循环 |
T2 | 欧拉筛 |
T3 | Floyd |
T4 | set |
T5 | 内存申请 |
T6 | 内存访问和缓存 |
T7 | 整数除法与取模 |
T8 | 浮点数运算 |
T9 | CPU流水线和循环展开 |
//Test 1
#include<cstdio>
using namespace std;
int main(){
int a=1000000000,b=1;
while(a)b^=a,a--;
printf("%d\n",b);
return 0;
}
//Test 2
#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;
}
//Test 3
#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;
}
//Test 4
#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;
}
//Test 5
#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;
}
//Test 6-1
#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;
}
//Test 6-2
#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;
}
//Test 6-3
#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;
}
//Test 7-1
#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;
}
//Test 7-2
#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;
}
//Test 8
#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;
}
//Test 9-1
#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;
}
//Test 9-2
#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;
}