結果
| 問題 | No.1791 Repeat Multiplication |
| コンテスト | |
| ユーザー |
ytft
|
| 提出日時 | 2021-12-25 14:47:01 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 193 ms / 3,000 ms |
| コード長 | 458 bytes |
| 記録 | |
| コンパイル時間 | 1,512 ms |
| コンパイル使用メモリ | 180,292 KB |
| 実行使用メモリ | 27,136 KB |
| 最終ジャッジ日時 | 2026-04-09 22:49:19 |
| 合計ジャッジ時間 | 6,991 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/algorithm:62,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/x86_64-pc-linux-gnu/bits/stdc++.h:53,
from main.cpp:1:
In function 'void std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long long int*; _Tp = int]',
inlined from 'void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = long long int*; _Tp = int]' at /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_algobase.h:979:21,
inlined from 'void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long long int*; _Tp = int]' at /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_algobase.h:1011:20,
inlined from 'int main()' at main.cpp:13:9:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_algobase.h:925:18: warning: 'void* __builtin_memset(void*, int, long unsigned int)' writing between 18446744056529682432 and 18446744073709551608 bytes into a region of size between 18446744073709551608 and 9223372036854775799 [-Wstringop-overflow=]
925 | *__first = __val;
| ~~~~~~~~~^~~~~~~
main.cpp: In function 'int main()':
main.cpp:6:20: note: at offset 8 into destination object 'b' of size [0, 9223372036854775807]
6 | long long a[N],b[N];
| ^
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int N,Q,x;
cin>>N>>Q;
long long a[N],b[N];
for(int i=N-1;i>=0;--i){
a[i]=1;
for(int j=i*2+1;j<N;j+=i+1){
a[i]+=a[j];
}
}
fill(b+1,b+N,0);
b[0]=1;
for(int i=0;i<N;++i){
for(int j=i*2+1;j<N;j+=i+1){
b[j]+=b[i];
}
}
for(int i=0;i<Q;++i){
cin>>x;
cout<<(a[x-1]*b[x-1])<<endl;
}
}
ytft