Submission #633581

#TimeUsernameProblemLanguageResultExecution timeMemory
633581AstraytIntercastellar (JOI22_ho_t1)C++14
100 / 100
80 ms10788 KiB
//君の手を握ってしまったら //孤独を知らないこの街には //もう二度と帰ってくることはできないのでしょう //君が手を差し伸べた 光で影が生まれる //歌って聞かせて この話の続き //連れて行って見たことない星まで //さユリ - 花の塔 #include <bits/stdc++.h> using namespace std; typedef long long ll; #define int ll #define starburst ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define pii pair<int,int> #define pb push_back #define ff first #define ss second #define N 100005 void solve(){ int n; cin >> n; vector<int> v(n); vector<pii> res; res.pb(pii(0, 0)); for(auto &x:v){ cin >> x; int t = x, cnt = 1; while(t % 2 == 0){ cnt *= 2; t /= 2; } if(t == res.back().ss) res.back().ff += cnt; else res.pb(pii(cnt, t)); } int m, k = res.size(); cin >> m; for(int i = 1; i < k; ++i) res[i].ff += res[i - 1].ff; while(m--){ int x; cin >> x; pii p = *lower_bound(res.begin(), res.end(), pii(x, 0)); cout << p.ss << '\n'; } } signed main(){ starburst int t = 1; //cin >> t; while(t--) solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...