結果

問題 No.216 FAC
コンテスト
ユーザー a2011404
提出日時 2017-03-23 09:56:51
言語 C90
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 429 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 151 ms
コンパイル使用メモリ 30,024 KB
最終ジャッジ日時 2026-02-24 00:32:23
ジャッジサーバーID
(参考情報)
judge4 / 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 #
raw source code

#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