标签:play www. output ios make rda result 有序 nod
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 #include <iostream> 2 #include <algorithm> 3 #include <cstdio> 4 #include <cstring> 5 using namespace std; 6 const int N=1e7+5; 7 unsigned x,y,z, A,B,C; 8 unsigned a[N]; 9 struct Node 10 { 11 int x; 12 int id; 13 unsigned y; 14 }tr[105]; 15 bool cmp(const Node s1,const Node s2) 16 { 17 return s1.x<s2.x; 18 } 19 bool cmp2(const Node s1,const Node s2) 20 { 21 return s1.id<s2.id; 22 } 23 24 unsigned rng61() { 25 unsigned t; 26 x ^= x << 16; 27 x ^= x >> 5; 28 x ^= x << 1; 29 t = x; 30 x = y; 31 y = z; 32 z = t ^ x ^ y; 33 return z; 34 } 35 36 int main() 37 { 38 ///cout << "Hello world!" << endl; 39 int n,m,Case=1; 40 while(scanf("%d%d%u%u%u",&n,&m,&A,&B,&C)!=EOF) 41 { 42 x = A, y = B, z = C; 43 for(int i=0;i<n;i++) a[i]=rng61(); 44 printf("Case #%d:",Case++); 45 for(int i=1;i<=m;i++) scanf("%d",&tr[i].x),tr[i].id=i; 46 sort(tr+1,tr+m+1,cmp); 47 48 int p=n; 49 for(int i=m;i>=1;i--) 50 { 51 int x = tr[i].x; 52 nth_element(a,a+x,a+p); 53 p=x; 54 tr[i].y=a[x]; 55 } 56 sort(tr+1,tr+m+1,cmp2); 57 for(int i=1;i<=m;i++) printf(" %u",tr[i].y); 58 puts(""); 59 } 60 return 0; 61 }//转自https://www.cnblogs.com/chen9510/p/7250651.html
hdu 6040 -Hints of sd0061(STL)
标签:play www. output ios make rda result 有序 nod
原文地址:https://www.cnblogs.com/llllrj/p/9424835.html