結果

問題 No.216 FAC
ユーザー Kmcode1
提出日時 2015-05-26 22:26:12
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 885 bytes
コンパイル時間 713 ms
コンパイル使用メモリ 99,232 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-15 00:30:00
合計ジャッジ時間 1,478 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:34:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   34 |         scanf("%d", &n);
      |         ~~~~~^~~~~~~~~~
main.cpp:36:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   36 |                 scanf("%d", &a[i]);
      |                 ~~~~~^~~~~~~~~~~~~
main.cpp:41:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   41 |                 scanf("%d", &b);
      |                 ~~~~~^~~~~~~~~~

ソースコード

diff #
プレゼンテーションモードにする

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cctype>
#include<cstdlib>
#include<algorithm>
#include<bitset>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<ctime>
#include<complex>
#include<functional>
#include<climits>
#include<cassert>
#include<iterator>
#include<unordered_map>
#include<unordered_set>
using namespace std;
int n;
#define MAX 102
int a[MAX];
int v[MAX];
int main(){
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 == 0){
sum += a[i];
}
else{
v[b] += a[i];
}
}
sort(v, v + MAX);
reverse(v, v + MAX);
if (sum >= v[0]){
puts("YES");
}
else{
puts("NO");
}
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0