結果
問題 | No.216 FAC |
ユーザー |
![]() |
提出日時 | 2017-07-10 19:56:17 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 438 bytes |
コンパイル時間 | 111 ms |
コンパイル使用メモリ | 22,912 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-07 07:08:06 |
合計ジャッジ時間 | 1,000 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 WA * 2 |
コンパイルメッセージ
main.cpp:3:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type] 3 | main(){ | ^~~~ main.cpp: In function ‘int main()’: main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | scanf("%d",&N); | ~~~~~^~~~~~~~~ main.cpp:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%d",&A[i]); | ~~~~~^~~~~~~~~~~~ main.cpp:13:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf("%d",&B); | ~~~~~^~~~~~~~~
ソースコード
#include<stdio.h> int score[100]; main(){ int N; int A[100]; scanf("%d",&N); for(int i = 0;i < N;i++){ scanf("%d",&A[i]); } int sum = 0; for(int i = 0;i < N;i++){ int B; scanf("%d",&B); if(B){score[B-1]+=A[i];} else{sum+=A[i];} } int max = 0; for(int i = 0;i < N;i++){ if(score[i] > max){max=score[i];} } printf("%s\n",sum>=max?"YES":"NO"); }