#include #include typedef long long ll; typedef struct { int s, k; }c_t; c_t c[100]; int cmp_s(const void *pa, const void *pb) { const c_t *a, *b; a=pa; b=pb; if(a->ss) return -1; return a->s>b->s; } int cmp_k(const void *pa, const void *pb) { const c_t *a, *b; a=pa; b=pb; if(a->kk) return -1; return a->k>b->k; } int main(void) { int w, h, n; int s_count, k_count, prev, i; while(scanf("%d%d%d", &w, &h, &n)==3) { for(i=0;i