結果
| 問題 |
No.3375 Binary Grid
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2025-10-09 00:22:48 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 513 bytes |
| コンパイル時間 | 3,231 ms |
| コンパイル使用メモリ | 274,952 KB |
| 実行使用メモリ | 16,200 KB |
| 最終ジャッジ日時 | 2025-11-21 20:50:14 |
| 合計ジャッジ時間 | 6,882 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 1 TLE * 1 -- * 5 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
ull calc(ull r, ull c) {
for (int i = (int) c; i < bit_width(r); i++) {
if (((r >> i) & 1) == 0) {
ull nr = r & ~((1LL << i) - 1) | (1 << i);
ull nc = i;
return max(nr - r, nc - c) + calc(nr, nc);
}
}
return r - 1;
}
void solve() {
ull R, C;
cin >> R >> C;
cout << calc(R, C - 1) << "\n";
}
int main() {
int T;
cin >> T;
while (T--) solve();
}