結果

問題 No.216 FAC
ユーザー gotutiyangotutiyan
提出日時 2017-11-16 00:18:45
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 782 bytes
コンパイル時間 812 ms
コンパイル使用メモリ 82,592 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-16 14:32:37
合計ジャッジ時間 2,033 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:44:9: 警告: ‘maxnum’ may be used uninitialized [-Wmaybe-uninitialized]
   44 |         if (maxnum == 0) cout << "YES" << endl;
      |         ^~
main.cpp:37:23: 備考: ‘maxnum’ はここで定義されています
   37 |         int maxx = 0, maxnum;
      |                       ^~~~~~

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <cstdlib>
#include <stack>
#include <queue>
#include <cmath>

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define repp(i,j,k) for(int i=j;i>=k;i--)
#define Sort(x) sort(x.begin(),x.end()); 
#define ll long long
int mod=1e9+7;
const int INF = 1e9;

using namespace std;


int main(void) {
	int n;
	cin >> n;
	vector<int> vv(n),v(102,0);
	rep(i, 0, n) {
		cin >> vv[i];
	}
	rep(i, 0, n) {
		int x;
		cin >> x;
		v[x] += vv[i];
	}

	int maxx = 0, maxnum;
	rep(i, 0, 102) {
		if (maxx <v[i]) {
			maxx = v[i];
			maxnum = i;
		}
	}
	if (maxnum == 0) cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}
0