Baidu star preliminary round (1) 1001 super ACMer, 1001 acmer
# Include <cstdio> # include <iostream> # include <cstring> # include <set> # include <cmath> # include <algorithm> # include <vector> # include <map> using namespace std; long int n, m, k; long int a [10005]; int main () {int t; cin> t; for (int kcase = 1; kcase <= t; kcase ++) {scanf ("% I64d % I64d % I64d", & n, & m, & k); for (int I = 0; I <n; I ++) {scanf ("% I64d", & a [I]);} sort (a, a + n); int l = 0; int r = n; int flag = 0; fo R (int I = 0; I <n; I ++) {long int * loc = lower_bound (a + l, a + n, m ); if (loc = a + n) {flag = 1; // winning break;} if (* loc> m) {loc --;} if (loc = a + N-1) {flag = 1; break;} if (loc <a + l) {flag = 0; break ;} else {m = * loc + k; l = loc-a; if (k> = 1) {k -- ;}} printf ("Case # % d: \ n ", kcase); if (flag) {printf (" why am I so diao? \ N ");} else {printf (" madan! \ N ") ;}} return 0 ;}