結果
| 問題 | No.3416 マッチ棒パズル Extra |
| コンテスト | |
| ユーザー |
noya2
|
| 提出日時 | 2025-12-23 01:28:45 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 793 bytes |
| 記録 | |
| コンパイル時間 | 3,438 ms |
| コンパイル使用メモリ | 301,180 KB |
| 実行使用メモリ | 19,408 KB |
| 最終ジャッジ日時 | 2025-12-23 01:28:58 |
| 合計ジャッジ時間 | 12,176 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 25 |
ソースコード
// すいません,yukicoder が遅すぎます(オンライン実行で 10+sec)
// あるいは,手元が速すぎます(2.3sec)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#include<atcoder/modint>
using namespace std;
using mint = atcoder::modint998244353;
void solve(){
uint64_t n; cin >> n;
n = n * 2 + 1;
uint64_t m = sqrt(n);
while ((m+1)*(m+1) <= n) m++;
while (m*m > n) m--;
uint64_t sum = 0;
for (uint64_t i = 1; i <= m; i += 2){
sum += (n + i) / (i * 2);
}
mint ans = sum;
ans *= 2;
ans -= mint((m+1)/2).pow(2);
ans -= n;
cout << ans.val() << '\n';
}
int main(){
cin.tie(0)->sync_with_stdio(0);
int t; cin >> t;
while (t--){
solve();
}
}
noya2