Result: Accepted
Time: 3ms
Memory: 1120kB
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
int comp(const void *p,const void *q){
return(*(char *)q-*(char *)p);
}
struct xyz{
int x;
int y;
int z;
};
int main(){
int n;
while(scanf("%d",&n)!=EOF){
int i,j,s1=1,s2=1,s3=1,count=0;
struct xyz a[15],b[15];
for(i=0;i<n;i++){
scanf("%d %d %d",&a[i].x,&a[i].y,&a[i].z);
}
b[0].x=a[0].x;
b[0].y=a[0].y;
for(i=1;i<n;i++){
count=0;
for(j=0;j<s1;j++){
if(a[i].x==b[j].x&&a[i].y==b[j].y){
count=1;
break;
}
}
if(count==0){
b[s1].x=a[i].x;
b[s1].y=a[i].y;
s1++;
}
}
b[0].x=a[0].x;
b[0].z=a[0].z;
for(i=1;i<n;i++){
count=0;
for(j=0;j<s2;j++){
if(a[i].x==b[j].x&&a[i].z==b[j].z){
count=1;
break;
}
}
if(count==0){
b[s2].x=a[i].x;
b[s2].z=a[i].z;
s2++;
}
}
b[0].z=a[0].z;
b[0].y=a[0].y;
for(i=1;i<n;i++){
count=0;
for(j=0;j<s3;j++){
if(a[i].z==b[j].z&&a[i].y==b[j].y){
count=1;
break;
}
}
if(count==0){
b[s3].z=a[i].z;
b[s3].y=a[i].y;
s3++;
}
}
printf("%d %d %d\n",s1,s2,s3);
}
}