标签:content bitset rda bsp name acm-icpc define preview acm
Time Limit: 5000/2500 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 2421 Accepted Submission(s): 736
unsigned x = A, y = B, z = C;
unsigned rng61() {
unsigned t;
x ^= x << 16;
x ^= x >> 5;
x ^= x << 1;
t = x;
x = y;
y = z;
z = t ^ x ^ y;
return z;
}
1 #pragma comment(linker, "/STACK:102400000,102400000") 2 #include <bits/stdc++.h> 3 #include <cstdlib> 4 #include <cstdio> 5 #include <iostream> 6 #include <cstdlib> 7 #include <cstring> 8 #include <algorithm> 9 #include <cmath> 10 #include <cctype> 11 #include <map> 12 #include <set> 13 #include <queue> 14 #include <bitset> 15 #include <string> 16 #include <complex> 17 #define LL long long 18 #define mod 1000000007 19 using namespace std; 20 int n,m; 21 unsigned x,y,z,t,ans[10000007]; 22 unsigned rng61(){ 23 x^=x<<16; 24 x^=x>>5; 25 x^=x<<1; 26 t=x; 27 x=y; 28 y=z; 29 z=t^x^y; 30 return z; 31 } 32 unsigned aa[10000007]; 33 struct node 34 { 35 int xx; 36 int pos; 37 friend bool operator < (node aaa,node bbb) 38 { 39 return aaa.xx < bbb.xx; 40 } 41 }bb[105]; 42 int main() 43 { 44 int t=0; 45 while(scanf("%d %d %u %u %u",&n,&m,&x,&y,&z)!=EOF){ 46 for(int i=1; i<=m; i++){ 47 scanf("%d",&bb[i].xx); 48 bb[i].pos=i; 49 } 50 for(int i=0; i<n; i++) 51 aa[i]=rng61(); 52 sort(bb+1,bb+1+m); 53 bb[m+1].xx=n; 54 for(int i=m;i>=1;i--){ 55 nth_element(aa,aa+bb[i].xx,aa+bb[i+1].xx); 56 ans[bb[i].pos]=aa[bb[i].xx]; 57 } 58 printf("Case #%d:",++t); 59 for(int i=1;i<=m;i++) 60 printf(" %u",ans[i]); 61 printf("\n"); 62 } 63 return 0; 64 }
标签:content bitset rda bsp name acm-icpc define preview acm
原文地址:http://www.cnblogs.com/hsd-/p/7296105.html