# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
801115 | 2023-08-02T04:38:14 Z | vjudge1 | Intercastellar (JOI22_ho_t1) | C++17 | 109 ms | 30528 KB |
#include <bits/stdc++.h> using namespace std; #define TL ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); #define rall(s) s.rbegin(),s.rend() #define all(s) s.begin(),s.end() #define pb push_back #define fi first #define se second #define ll long long #define ld long double #define YES cout<<"YES\n" #define Yes cout<<"Yes\n" #define yes cout<<"yes\n" #define NO cout<<"NO\n" #define No cout<<"No\n" #define no cout<<"no\n" const int N = 5e5 + 9 , mod = 1e9 + 7; ll d[N] = {} , a[N] = {}, dp[N] = {}, b[N] , c[N]; vector<int>v[N] , v1[N]; void solve(){ ll q , i , j , m ,n, z , s = 0, f, l , r , k , x , y , mn = 1e18 , mx = -1; cin>>n; for(i = 1; i <= n; i++) cin>>a[i]; vector<pair<int,int>>v; b[0] = 1; for(i = 1; i <= 40; i++) b[i] = b[i - 1] * 2; for(i = 1; i <= n; i++){ for(j = 0; j <= 40; j++) if((a[i] % b[j]) != 0){ k = j - 1; break; } v.pb({a[i] / b[k] , b[k]}); } i = 0; for(auto to : v) i++ , c[i] = c[i - 1] + to.se; cin>>q; while(q--){ cin>>k; l = 1; r = n; while(l != r){ m = (l + r) / 2; if(c[m] >= k) r= m; else l = m + 1; } cout<<v[l - 1].fi<<"\n"; } } int main(){ TL; /* #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif */ int t = 1; //cin>>t; while(t--) { solve(); } } // Author : حسن
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 23764 KB | Output is correct |
2 | Correct | 10 ms | 23756 KB | Output is correct |
3 | Correct | 31 ms | 28504 KB | Output is correct |
4 | Correct | 37 ms | 25384 KB | Output is correct |
5 | Correct | 59 ms | 28944 KB | Output is correct |
6 | Correct | 39 ms | 28064 KB | Output is correct |
7 | Correct | 74 ms | 29016 KB | Output is correct |
8 | Correct | 61 ms | 29024 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 23764 KB | Output is correct |
2 | Correct | 13 ms | 23764 KB | Output is correct |
3 | Correct | 10 ms | 23764 KB | Output is correct |
4 | Correct | 10 ms | 23796 KB | Output is correct |
5 | Correct | 12 ms | 23764 KB | Output is correct |
6 | Correct | 11 ms | 23764 KB | Output is correct |
7 | Correct | 11 ms | 23860 KB | Output is correct |
8 | Correct | 11 ms | 23844 KB | Output is correct |
9 | Correct | 10 ms | 23764 KB | Output is correct |
10 | Correct | 11 ms | 23728 KB | Output is correct |
11 | Correct | 11 ms | 23868 KB | Output is correct |
12 | Correct | 11 ms | 23764 KB | Output is correct |
13 | Correct | 14 ms | 23852 KB | Output is correct |
14 | Correct | 11 ms | 23764 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 23764 KB | Output is correct |
2 | Correct | 10 ms | 23756 KB | Output is correct |
3 | Correct | 31 ms | 28504 KB | Output is correct |
4 | Correct | 37 ms | 25384 KB | Output is correct |
5 | Correct | 59 ms | 28944 KB | Output is correct |
6 | Correct | 39 ms | 28064 KB | Output is correct |
7 | Correct | 74 ms | 29016 KB | Output is correct |
8 | Correct | 61 ms | 29024 KB | Output is correct |
9 | Correct | 10 ms | 23764 KB | Output is correct |
10 | Correct | 13 ms | 23764 KB | Output is correct |
11 | Correct | 10 ms | 23764 KB | Output is correct |
12 | Correct | 10 ms | 23796 KB | Output is correct |
13 | Correct | 12 ms | 23764 KB | Output is correct |
14 | Correct | 11 ms | 23764 KB | Output is correct |
15 | Correct | 11 ms | 23860 KB | Output is correct |
16 | Correct | 11 ms | 23844 KB | Output is correct |
17 | Correct | 10 ms | 23764 KB | Output is correct |
18 | Correct | 11 ms | 23728 KB | Output is correct |
19 | Correct | 11 ms | 23868 KB | Output is correct |
20 | Correct | 11 ms | 23764 KB | Output is correct |
21 | Correct | 14 ms | 23852 KB | Output is correct |
22 | Correct | 11 ms | 23764 KB | Output is correct |
23 | Correct | 35 ms | 25808 KB | Output is correct |
24 | Correct | 44 ms | 27948 KB | Output is correct |
25 | Correct | 72 ms | 30528 KB | Output is correct |
26 | Correct | 60 ms | 27484 KB | Output is correct |
27 | Correct | 60 ms | 27724 KB | Output is correct |
28 | Correct | 99 ms | 29768 KB | Output is correct |
29 | Correct | 109 ms | 28944 KB | Output is correct |
30 | Correct | 47 ms | 25172 KB | Output is correct |
31 | Correct | 107 ms | 29488 KB | Output is correct |