Submission #941825

#TimeUsernameProblemLanguageResultExecution timeMemory
941825ErJIntercastellar (JOI22_ho_t1)C++17
100 / 100
431 ms10696 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define vi vector<ll> #define vvi vector<vector<ll>> #define vs vector<string> #define vc vector<char> #define vb vector<bool> #define vp vector<pair<ll, ll>> #define pp pair<ll, ll> #define qi queue<ll> #define qp queue<pp> #define pqi priority_queue<ll> #define pqp priority_queue<pp> #define mi map<ll, ll> #define mpi map<pp, ll> #define mip map<ll, pp> #define mpp map<pp, pp> #define mb map<ll, bool> #define si set<ll> #define sp set<pp> #define mod 1000000007 #define rep(a, b) for(int a = 0; a < (b); a++) #define rep2(a, b) for(int a = 1; a < (b); a++) #define inf 100000000000000 int main() { int n; cin >> n; vi input(n); vp spare(n); //count, length rep(i, n) { cin >> input[i]; ll x = 1; while (input[i] % 2 == 0) { x *= 2; input[i] /= 2; } spare[i] = { x, input[i] }; } int q; cin >> q; ll akt = 0; ll index = -1; rep(i, q) { ll quest; cin >> quest; if (quest <= akt) { cout << spare[index].second << endl; } else { while (quest > akt) { index++; akt += spare[index].first; } cout << spare[index].second << endl; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...