結果

問題 No.216 FAC
ユーザー tokizo
提出日時 2018-01-14 11:41:15
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 881 bytes
コンパイル時間 861 ms
コンパイル使用メモリ 76,984 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 02:31:35
合計ジャッジ時間 1,459 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:29:9: warning: argument to variable-length array is too large [-Wvla-larger-than=]
   29 |     int T[ma + 1] = {};
      |         ^
main.cpp:29:9: note: limit is 9223372036854775807 bytes, but argument is 18446744065119617028

ソースコード

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

#include <iostream>
#include <math.h>
#include <algorithm>
#include <functional>
#include <vector>
#include <typeinfo>
#include <climits>
#include <ctype.h>
#include <string>
#include <stdio.h>
using namespace std;
#define INIT cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i, a, n) for (int i = a; i < n; i++)
#define REP(i, n) for(int i = 0; i < n; i++)
int main()
{
INIT;
int n;
cin >> n;
int A[n], B[n];
REP(i, n) cin >> A[i];
int ma = INT_MIN;
REP(i, n){
cin >> B[i];
ma = max(ma, B[i]);
}
int T[ma + 1] = {};
int k = 0;
REP(i, n){
if(B[i] == 0) k += A[i];
else T[B[i]] += A[i];
}
int f = 0;
REP(i, ma + 1){
if(k < T[i]){
cout << "NO" << endl;
f = 1;
break;
}
}
if(f == 0) cout << "YES" << endl;
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0