제출 #1197230

#제출 시각아이디문제언어결과실행 시간메모리
1197230TahirAliyevIntercastellar (JOI22_ho_t1)C++20
100 / 100
43 ms7156 KiB
#include <bits/stdc++.h> // #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops") // #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define int long long #define pii pair<int, int> #define ld long double #define all(v) v.begin(), v.end() using namespace std; const int oo = 1e18 + 9; const int MAX = 1e6 + 6; int MOD = 998244353; void solve(){ int n; cin >> n; int arr[n + 1]; vector<pii> v; for(int i = 1; i <= n; i++){ cin >> arr[i]; int a = arr[i]; while(a % 2 == 0) a /= 2; v.push_back({arr[i] / a, a}); } int q; cin >> q; int i = 0, sum = 0; while(q--){ int a; cin >> a; while(i < n && sum + v[i].first < a){ sum += v[i].first; i++; } cout << v[i].second << '\n'; } } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); 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...