Skip to content

Instantly share code, notes, and snippets.

@KT-Yeh
Created December 29, 2013 05:09
Show Gist options
  • Save KT-Yeh/8167644 to your computer and use it in GitHub Desktop.
Save KT-Yeh/8167644 to your computer and use it in GitHub Desktop.
#include<cstdio>
using namespace std;
int main()
{
int T,t,N,M,K,k,i;
scanf("%d",&T);
for(t=1;t<=T;t++)
{
int e[100000],w[100000];
int cross=0;
scanf("%d %d %d",&N,&M,&K);
for(k=0;k<K;k++){
scanf("%d %d",&e[k],&w[k]);
for(i=0;i<k;i++){
if(e[i]<e[k])
if(w[i]>w[k]) cross++;
else if(e[i]>e[k])
if(w[i]<w[k]) cross++;
}
}
printf("Test case %d: %d\n",t,cross);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment