結果

問題 No.368 LCM of K-products
ユーザー kotamanegikotamanegi
提出日時 2016-04-30 00:06:22
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,498 bytes
コンパイル時間 1,173 ms
コンパイル使用メモリ 94,120 KB
実行使用メモリ 394,296 KB
最終ジャッジ日時 2024-04-15 06:22:59
合計ジャッジ時間 42,368 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,132 ms
393,964 KB
testcase_01 AC 1,212 ms
394,208 KB
testcase_02 AC 1,169 ms
393,984 KB
testcase_03 AC 1,101 ms
394,172 KB
testcase_04 AC 1,147 ms
394,248 KB
testcase_05 AC 1,522 ms
394,112 KB
testcase_06 AC 1,104 ms
394,060 KB
testcase_07 WA -
testcase_08 AC 1,095 ms
394,112 KB
testcase_09 AC 1,115 ms
394,112 KB
testcase_10 AC 1,118 ms
394,240 KB
testcase_11 AC 1,095 ms
394,112 KB
testcase_12 AC 1,115 ms
394,112 KB
testcase_13 AC 1,100 ms
394,012 KB
testcase_14 AC 1,116 ms
394,116 KB
testcase_15 AC 1,147 ms
394,212 KB
testcase_16 AC 1,129 ms
394,296 KB
testcase_17 AC 1,123 ms
394,080 KB
testcase_18 AC 1,129 ms
394,096 KB
testcase_19 AC 1,118 ms
394,080 KB
testcase_20 AC 1,115 ms
394,088 KB
testcase_21 AC 1,112 ms
394,132 KB
testcase_22 AC 1,140 ms
394,188 KB
testcase_23 AC 1,107 ms
394,112 KB
testcase_24 AC 1,104 ms
393,984 KB
testcase_25 AC 1,106 ms
394,112 KB
testcase_26 AC 1,109 ms
394,112 KB
testcase_27 AC 1,114 ms
394,112 KB
testcase_28 AC 1,110 ms
394,112 KB
testcase_29 AC 1,101 ms
394,112 KB
testcase_30 WA -
testcase_31 AC 1,119 ms
394,112 KB
testcase_32 AC 1,136 ms
394,112 KB
testcase_33 WA -
testcase_34 AC 1,134 ms
394,216 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:33:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   33 |         scanf("%d%d", &n, &k);
      |         ~~~~~^~~~~~~~~~~~~~~~

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#define  _SCL_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cstdint>
#define MAX_MOD 1000000007
#define REP(i,n) for(int i = 0;i < n;++i)
using namespace std;
int sosuu_counter[110000][1000] = {};
vector<int> whereis;
map<int, int> hogee;
int main() {
	int n, k;
	scanf("%d%d", &n, &k);
	REP(i, n) {
		long long n;
		cin >> n;
		int cnt = 2;
		while (true) {
			if (n % cnt == 0) {
				sosuu_counter[cnt][i]++;
				n /= cnt;
			}
			else {
				cnt++;
				if (cnt > sqrt(n)) {
					hogee[n]++;
					whereis.push_back(n);
					goto ok;
				}
			}
		}
	ok:;
	}
	long long ans = 1;
	for (int i = 0;i < whereis.size();++i) {
		for (int q = 0;q < i;++q) {
			if (whereis[i] == whereis[q]) goto ah;
		}
		for (int q = 0;q < k && q < hogee[whereis[i]];++q) {
			ans = (ans*whereis[i]) % MAX_MOD;
		}
	ah:;
	}
	for (int i = 2;i <= 100000;++i) {
		sort(sosuu_counter[i], sosuu_counter[i] + 1000,greater<int>());
		int counter = 0;
		for (int q = 0;q < k;++q) {
			counter += sosuu_counter[i][q];
		}
		for (int q = 0;q < counter;++q) {
			ans = (ans*i) % MAX_MOD;
		}
	}
	cout << ans % MAX_MOD << endl;
}
0