結果

問題 No.216 FAC
ユーザー a2011404
提出日時 2017-03-23 09:56:51
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 429 bytes
コンパイル時間 120 ms
コンパイル使用メモリ 20,992 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-05 20:32:17
合計ジャッジ時間 796 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%d", &n);
      |         ^~~~~~~~~~~~~~~
main.c:9:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |                 scanf("%d", &a[i]);
      |                 ^~~~~~~~~~~~~~~~~~
main.c:12:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |                 scanf("%d", &b[i]);
      |                 ^~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>			
			
int main(void) {			

	int i,n,a[100],b[100],k[100]={0},flag=0,max=0;
			
	scanf("%d", &n);		
	for (i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	for (i = 0; i < n; i++) {
		scanf("%d", &b[i]);
	}

	for (i = 0; i < n; i++) {
		k[b[i]] += a[i];
		if(max<b[i])	max=b[i];
	}

	for (i = 1; i <= max; i++) {
		if(k[0] < k[i]){flag=1;break;
		}else		flag=0;
	}

	printf(flag==0?"YES":"NO");
	return 0;		
}			
0