제출 #923104

#제출 시각아이디문제언어결과실행 시간메모리
923104tvladm2009Intercastellar (JOI22_ho_t1)C++17
100 / 100
73 ms11660 KiB
#include <iostream> #include <complex> #include <vector> #include <string> #include <algorithm> #include <cstdio> #include <numeric> #include <cstring> #include <ctime> #include <cstdlib> #include <set> #include <map> #include <unordered_map> #include <unordered_set> #include <list> #include <cmath> #include <bitset> #include <cassert> #include <queue> #include <stack> #include <deque> #include <random> using namespace std; template<typename T1, typename T2> inline void chkmin(T1 &a, T2 b) {if (a > b) a = b;} template<typename T1, typename T2> inline void chkmax(T1 &a, T2 b) {if (a < b) a = b;} #define files(FILENAME) read(FILENAME); write(FILENAME) #define read(FILENAME) freopen((FILENAME + ".in").c_str(), "r", stdin) #define write(FILENAME) freopen((FILENAME + ".out").c_str(), "w", stdout) #define all(c) (c).begin(), (c).end() #define sz(c) (int)(c).size() #define left left228 #define right right228 #define y1 y1228 #define mp make_pair #define pb push_back #define y2 y2228 #define rank rank228 using ll = long long; using ld = long double; const string FILENAME = "input"; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); //read(FILENAME); int n; cin >> n; vector<pair<ll, ll>> v; for (int i = 1; i <= n; i++) { ll x; cin >> x; ll cnt = 1; while (x % 2 == 0) { x /= 2; cnt *= 2; } v.pb(mp(cnt, x)); } vector<ll> pref(n + 1, 0); for (int i = 1; i <= sz(v); i++) { pref[i] = pref[i - 1] + v[i - 1].first; } int q; cin >> q; while (q--) { ll x; cin >> x; ll pos = lower_bound(all(pref), x) - pref.begin(); cout << v[pos - 1].second << '\n'; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...