Codecraft-17 and Codeforces Round #391 (Div. 1 + Div. 2, combined), problem: (C) Felicity is Coming! Solution in C/C++
#include<stdio.h> #include<stdlib.h> #define m 1000000007u typedef long long unsigned llu; typedef unsigned u; int C(const void*x,const void*y){return*(u*)x-*(u*)y;} int D(const void*x,const void*y) { if(*(llu*)x>*(llu*)y)return 1; if(*(llu*)x<*(llu*)y)return-1; return 0; } llu H,P; u F,Q; int main() { …