結果
| 問題 | No.3718 XOR Escape |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-18 23:07:51 |
| 言語 | C++17 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
RE
不安定
|
| 実行時間 | - |
| コード長 | 868 bytes |
| 記録 | |
| コンパイル時間 | 1,267 ms |
| コンパイル使用メモリ | 216,892 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2026-09-18 23:07:57 |
| 合計ジャッジ時間 | 3,484 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 RE * 2 |
| other | AC * 13 RE * 5 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
long long N,a,b,c; cin >> N >> a >> b >> c;
a++,b++,c++;
vector<long long> V;
if(__popcount((unsigned long long)a) == 1) V.push_back(a);
if(__popcount((unsigned long long)b) == 1) V.push_back(b);
if(__popcount((unsigned long long)c) == 1) V.push_back(c);
sort(V.begin(),V.end());
if(V.size() == 0) cout << N << endl;
else if(V.size() == 1){
long long answer = N-N/V.at(0);
if(N%V.at(0) >= V.at(0)/2) answer--;
cout << answer << endl;
}
else if(V.at(0) != 2){
long long answer = N-N/V.at(0)-N/V.at(1);
if(N%V.at(0) >= V.at(0)/2) answer--;
if(N%V.at(1) >= V.at(1)/2) answer--;
cout << answer << endl;
}
else{
assert(false);
}
}