結果
問題 | No.216 FAC |
ユーザー |
|
提出日時 | 2018-03-17 18:04:24 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 719 bytes |
コンパイル時間 | 420 ms |
コンパイル使用メモリ | 37,068 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-24 00:30:39 |
合計ジャッジ時間 | 1,402 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
コンパイルメッセージ
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:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%d",&a[i]); | ~~~~~^~~~~~~~~~~~ main.cpp:14:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 14 | scanf("%d",&b[i]); | ~~~~~^~~~~~~~~~~~
ソースコード
#include <stdio.h>#include <algorithm>int main(){//inputint N;scanf("%d",&N);int a[100];int b[100];for (int i = 0;i < N;i++){scanf("%d",&a[i]);}for (int i = 0;i < N;i++){scanf("%d",&b[i]);}//calculate total score of other 100 participants and Kint score[100] = {0};int score_K = 0;for (int i = 0;i < N;i++){if (b[i] == 0){score_K += a[i];}else{score[b[i]-1] += a[i];}}//sort score array of other participantsstd::sort(score,score+100);//outputif (score_K >= score[99]){printf("YES\n");}else{printf("NO\n");}return 0;}