Submission #1501757


Source Code Expand

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#define swap(type,a,b) do{type t=a;a=b;b=t;}while(0);
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ll long long
#define INF 100000000
#define FOR(i,a,n) for(i=(a);i<(n);i++)
int comp(const void* a,const void* b){
	return *(int*)a-*(int*)b;
}
void fill(int a[],int b,int c){
	int i;
	FOR(i,0,b) a[i]=c;
	return;
}
int binary_search(int a[],int n,int k){
	int left=0,right=n;
	while(right>left){
		int mid=(left+right)/2;
		if(a[mid]==k) return 1;
		if(a[mid]<k) left=mid+1;
		else right=mid;
	}
	return 0;
}
int a[100000];
int main(void)
{
	int na,nb,b,s1=0,i;
	scanf("%d%d",&na,&nb);
	FOR(i,0,na) scanf("%d",&a[i]);
	qsort(a,na,sizeof(int),comp);
	FOR(i,0,nb){
		scanf("%d",&b);
		if(binary_search(a,na,b)) s1++;
	}
	printf("%.10lf\n",(double)s1/(na+nb-s1));
	return 0;
}

Submission Info

Submission Time
Task B - メタ構文変数
User trainstation
Language C (GCC 5.4.1)
Score 100
Code Size 947 Byte
Status AC
Exec Time 49 ms
Memory 892 KB

Compile Error

./Main.c: In function ‘main’:
./Main.c:34:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&na,&nb);
  ^
./Main.c:35:14: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
  FOR(i,0,na) scanf("%d",&a[i]);
              ^
./Main.c:38:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&b);
   ^

Judge Result

Set Name Sample Subtask1 Subtask2 Subtask3
Score / Max Score 0 / 0 40 / 40 30 / 30 30 / 30
Status
AC × 2
AC × 11
AC × 19
AC × 28
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
Subtask1 sample_01.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt
Subtask2 sample_01.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt
Subtask3 sample_01.txt, sample_02.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask3_01.txt, subtask3_02.txt, subtask3_03.txt, subtask3_04.txt, subtask3_05.txt, subtask3_06.txt, subtask3_07.txt, subtask3_08.txt
Case Name Status Exec Time Memory
sample_01.txt AC 1 ms 128 KB
sample_02.txt AC 1 ms 128 KB
subtask1_01.txt AC 1 ms 128 KB
subtask1_02.txt AC 1 ms 128 KB
subtask1_03.txt AC 1 ms 128 KB
subtask1_04.txt AC 1 ms 128 KB
subtask1_05.txt AC 1 ms 128 KB
subtask1_06.txt AC 1 ms 128 KB
subtask1_07.txt AC 1 ms 128 KB
subtask1_08.txt AC 1 ms 128 KB
subtask1_09.txt AC 1 ms 128 KB
subtask1_10.txt AC 1 ms 128 KB
subtask2_01.txt AC 17 ms 380 KB
subtask2_02.txt AC 44 ms 892 KB
subtask2_03.txt AC 18 ms 508 KB
subtask2_04.txt AC 44 ms 892 KB
subtask2_05.txt AC 10 ms 380 KB
subtask2_06.txt AC 22 ms 508 KB
subtask2_07.txt AC 35 ms 892 KB
subtask2_08.txt AC 44 ms 892 KB
subtask3_01.txt AC 30 ms 636 KB
subtask3_02.txt AC 49 ms 892 KB
subtask3_03.txt AC 13 ms 380 KB
subtask3_04.txt AC 48 ms 892 KB
subtask3_05.txt AC 28 ms 892 KB
subtask3_06.txt AC 49 ms 892 KB
subtask3_07.txt AC 34 ms 892 KB
subtask3_08.txt AC 49 ms 892 KB