結果
| 問題 | No.1057 素敵な日 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-22 21:29:46 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 16 ms / 2,000 ms |
| コード長 | 1,593 bytes |
| コンパイル時間 | 1,078 ms |
| コンパイル使用メモリ | 97,220 KB |
| 最終ジャッジ日時 | 2025-01-10 14:16:21 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 7 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <numeric>
#include <queue>
#include <map>
#include <math.h>
#include <stack>
#include <math.h>
using namespace std;
typedef long long int ll;
using ull = unsigned long long;
int bsf(ull x) { return __builtin_ctzll(x); }
struct fastset{
int N,lg;
vector<vector<ull>> seg;
fastset(int N):N(N){
while(N>1){
seg.push_back(vector<ull>((N+63)/64));
N=(N+63)/64;
}
lg=seg.size();
}
void ins(int x){
for(int i=0;i<lg;i++){
int D=x/64,R=x%64;
seg[i][D]|=(1ULL<<R);
x/=64;
}
}
void cle(int x){
for(int i=0;i<lg;i++){
int D=x/64,R=x%64;
seg[i][D] &= ~(!1ULL<<R);
if(i&&seg[i-1][x]!=0){
seg[i][D]|=(1ULL<<R);
}
x/=64;
}
}
// x以上の最小の要素
int upp(int x){
for(int i=0;i<lg;i++){
int D=x/64,R=x%64;
if(D==seg[i].size())break;
ull B=seg[i][D]>>R;
if(!B){
x=x/64+1;
continue;
}
// find
x+=bsf(B);
for(int j=i-1;j>=0;j--){
x*=64;
int D=x/64;
x+=bsf(seg[j][D]);
}
return x;
}
return N;
}
};
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int a,b; cin >> a >> b;
int dif=abs(a-b);
cout << a+b-max(dif-1,0)-1 << endl;
}