結果

問題 No.216 FAC
ユーザー gotutiyangotutiyan
提出日時 2017-11-16 00:18:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 782 bytes
コンパイル時間 717 ms
コンパイル使用メモリ 84,480 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-03 22:51:22
合計ジャッジ時間 1,558 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:44:9: warning: 'maxnum' may be used uninitialized [-Wmaybe-uninitialized]
   44 |         if (maxnum == 0) cout << "YES" << endl;
      |         ^~
main.cpp:37:23: note: 'maxnum' was declared here
   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