結果
| 問題 |
No.390 最長の数列
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-08-01 22:51:23 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 909 bytes |
| コンパイル時間 | 703 ms |
| コンパイル使用メモリ | 90,384 KB |
| 実行使用メモリ | 50,560 KB |
| 最終ジャッジ日時 | 2024-10-11 00:28:13 |
| 合計ジャッジ時間 | 8,492 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 WA * 1 |
| other | AC * 7 WA * 8 |
ソースコード
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, string> pls;
#define MAX_N 1000000
int n;
int a[100010];
map<int, int> m;
int main()
{
cin >> n;
int mx = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
m[a[i]] = 1;
mx = max(mx,a[i]);
}
sort(a, a + n);
int num, num_mx = 0;
for (int i = 0; i < n - num_mx; i++) {
if (a[i] == 1)continue;
num = 0;
for (int j = 1; a[i] * j <= mx; j++) {
if (m[a[i] * j]) {
num++;
}
}
num_mx = max(num_mx, num);
}
if (a[0] == 1)num_mx++;
cout << num_mx << endl;
return 0;
}