結果
問題 |
No.1742 Binary Indexed Train
|
ユーザー |
![]() |
提出日時 | 2021-11-12 22:53:16 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 581 bytes |
コンパイル時間 | 3,337 ms |
コンパイル使用メモリ | 228,344 KB |
実行使用メモリ | 17,096 KB |
最終ジャッジ日時 | 2024-11-25 20:47:07 |
合計ジャッジ時間 | 68,916 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 TLE * 12 |
ソースコード
#include <bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; using ll=long long; using Graph=vector<vector<pair<int,ll>>>; #define INF 1000000000 #define MOD 998244353 #define MAX 300000 int main(){ int N,Q; cin>>N>>Q; for(int q=0;q<Q;q++){ ll S,T; cin>>S>>T; int ans=0; for(int cnt=0;cnt<2*N+10;cnt++){ for(int i=N;i>=0;i--){ if(S%(1LL<<i)!=0){ continue; } if(S+(1LL<<i)<=T){ S+=(1LL<<i); ans++; break; } } } cout<<ans<<'\n'; } }