結果
| 問題 | No.689 E869120 and Constructing Array 3 |
| コンテスト | |
| ユーザー |
xuzijian629
|
| 提出日時 | 2018-08-30 08:50:10 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 1,390 bytes |
| 記録 | |
| コンパイル時間 | 917 ms |
| コンパイル使用メモリ | 104,684 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-04 07:27:42 |
| 合計ジャッジ時間 | 2,963 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_algobase.h:64,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/string:53,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/locale_classes.h:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ios_base.h:43,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ios:46,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ostream.h:43,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ostream:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/iostream:43,
from main.cpp:1:
In constructor 'constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U1 = int&; _U2 = int&; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<true, _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = true; _T1 = long int; _T2 = long int]',
inlined from 'ii simdiv(int)' at main.cpp:29:19:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_pair.h:902:11: warning: 'a' may be used uninitialized [-Wmaybe-uninitialized]
902 | : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp: In function 'ii simdiv(int)':
main.cpp:22:9: note: 'a' was declared here
22 | int a, b;
| ^
In constructor 'constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U1 = int&; _U2 = int&; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<true, _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = true; _T1 = long int; _T2 = long int]',
inlined from 'ii simdiv(int)' at main.cpp:29:19:
/home/l
ソースコード
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <cassert>
#pragma GCC optimize("O3")
#pragma comment(linker, "STACK:36777216")
using namespace std;
using i64 = int64_t;
constexpr i64 mod = 17;
using vi = vector<i64>;
using vvi = vector<vi>;
using ii = pair<i64, i64>;
using vii = vector<ii>;
ii simdiv(int n) {
int a, b;
for (int i = 1; i * i <= n; i++) {
if (n % i == 0) {
a = i;
b = n / i;
}
}
return ii(a, b);
}
int main() {
int k;
cin >> k;
if (k == 0) {
cout << "1\n1\n";
return 0;
}
int n = k;
while (1) {
ii r = simdiv(n);
if (r.first + r.second + k - n < 248) {
vi ans;
for (int i = 0; i < r.first; i++) {
ans.push_back(2);
}
for (int i = 0; i < r.second; i++) {
ans.push_back(3);
}
ans.push_back(7);
for (int i = 0; i < k - n; i++) {
ans.push_back(6);
}
cout << ans.size() << endl;
for (int i = 0; i < ans.size() - 1; i++) {
cout << ans[i] << " ";
}
cout << ans.back() << endl;
return 0;
}
n--;
}
}
xuzijian629