結果
| 問題 |
No.3102 floor sqrt xor
|
| コンテスト | |
| ユーザー |
noya2
|
| 提出日時 | 2025-04-08 02:20:35 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 537 bytes |
| コンパイル時間 | 3,494 ms |
| コンパイル使用メモリ | 275,060 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-04-08 02:20:54 |
| 合計ジャッジ時間 | 18,469 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 16 WA * 14 |
ソースコード
// USO (WA)
#include <bits/stdc++.h>
using ll = long long;
const ll width = 1001001;
ll isqrt(ll n){
if (n == 0) return 0;
ll x = std::sqrt(n) - 1;
return (x * (x + 2) < n ? x + 1 : x);
}
void solve(){
ll n; std::cin >> n;
for (ll k = n-width; k <= n+width; k++){
if (0 <= k){
if (isqrt(k) ^ k ^ n) continue;
std::cout << k << '\n';
return ;
}
}
std::cout << -1 << '\n';
}
int main(){
int t; std::cin >> t;
while (t--){
solve();
}
}
noya2