#include<bits/stdc++.h>
using namespace std;
void sort(unsigned *a,int n)
{
unsigned *b=new unsigned[n];
int cnt1[256],cnt2[256],cnt3[256],cnt4[256];
memset(cnt1,0,sizeof(cnt1)),memset(cnt2,0,sizeof(cnt2)),memset(cnt3,0,sizeof(cnt3)),memset(cnt4,0,sizeof(cnt4));
for(int j=1; j<=n; ++j) ++cnt1[a[j]&255],++cnt2[a[j]>>8&255],++cnt3[a[j]>>16&255],++cnt4[a[j]>>24];
for(int j=1; j<256; ++j) cnt1[j]+=cnt1[j-1],cnt2[j]+=cnt2[j-1],cnt3[j]+=cnt3[j-1],cnt4[j]+=cnt4[j-1];
for(int j=n; j>=1; --j) b[cnt1[a[j]&255]--]=a[j];
for(int j=n; j>=1; --j) a[cnt2[b[j]>>8&255]--]=b[j];
for(int j=n; j>=1; --j) b[cnt3[a[j]>>16&255]--]=a[j];
for(int j=n; j>=1; --j) a[cnt4[b[j]>>24&255]--]=b[j];
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 1.031 ms | 812 KB | Wrong Answer | Score: 0 | 显示更多 |
Testcase #2 | 1.094 s | 762 MB + 996 KB | Wrong Answer | Score: 0 | 显示更多 |
Testcase #3 | 2.19 s | 1525 MB + 932 KB | Wrong Answer | Score: 0 | 显示更多 |