Submission #873758

#TimeUsernameProblemLanguageResultExecution timeMemory
873758AlexIntercastellar (JOI22_ho_t1)C++14
35 / 100
2007 ms20444 KiB
#include <bits/stdc++.h> #define int long long using namespace std; int Dos(int n) { return (n & (~(n - 1))); } int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; map<int,int>m; vector<int>v; map<int,int>m2; int cont = 0; for(int i = 0 ; i < n ; i++){ int a; cin >> a; if(!(a & 1)){ int l = Dos(a); cont += l - 1; v.push_back(cont); if(l == a){ m[cont] = 1; } else m[cont] = a / l; } else m[cont] = a; cont++; } int ms ; cin >> ms; for(int i = 0 ; i < ms ; i++){ int k ; cin >> k; if(m[k - 1] != 0){ cout << m[k - 1] << "\n"; } else{ for(int x : v){ if(k - 1<= x){ cout << m[x] << "\n"; break; } } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...