답안 #966935

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
966935 2024-04-20T16:13:14 Z resfast Intercastellar (JOI22_ho_t1) C++17
100 / 100
85 ms 10764 KB
	#include <bits/stdc++.h>
	#pragma GCC optimize("O3")
	using namespace std;
	#define islam_zymchybekov void solve()
	#define ios ios::sync_with_stdio(false); cin.tie(NULL);
	#define pb push_back
	#define all(x) x.begin(), x.end()
	#define rall(x) x.rbegin(), x.rend()
	#define fr first
	#define sc second
	#define nl cout<<'\n';
	#define int long long
	typedef vector<int> vi;
	typedef pair<int,int> pi;
	const int  N= 200005;
	int n, q, a[N], x;
	int b[N], p[N];
	islam_zymchybekov{
		cin>>n;
		for(int i=0;i<n;i++){
			cin>>a[i];
	        b[i]=1;
	        while(a[i]%2==0) {
	            a[i]/=2;
	            b[i]*=2;
	        }
		}
		for(int i=0;i<n;i++)p[i+1]=p[i]+b[i];
		cin >> q;
	    while (q--) {
	        cin >> x;
	        int id = lower_bound(p, p + n, x) - p;
	        id--;
	        cout<<a[id];nl
	    }
	}
	 main(){
	    ios;
	    int T = 1;
	//	    cin >> T;
	    while(T--){
	        solve();
	    }
	    //cout<<fixed<<setprecision(10);
	    //cerr<<"Time:"<<1000*((double)clock())/(double)CLOCKS_PER_SEC<<"ms\n";__int128
	}
	
	
	
	
	
	
	
	

Compilation message

Main.cpp:37:3: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   37 |   main(){
      |   ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 2 ms 4444 KB Output is correct
3 Correct 16 ms 5724 KB Output is correct
4 Correct 23 ms 5980 KB Output is correct
5 Correct 38 ms 7040 KB Output is correct
6 Correct 22 ms 5980 KB Output is correct
7 Correct 46 ms 7252 KB Output is correct
8 Correct 39 ms 7260 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 4444 KB Output is correct
2 Correct 1 ms 4556 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4528 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4572 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 2 ms 4444 KB Output is correct
3 Correct 16 ms 5724 KB Output is correct
4 Correct 23 ms 5980 KB Output is correct
5 Correct 38 ms 7040 KB Output is correct
6 Correct 22 ms 5980 KB Output is correct
7 Correct 46 ms 7252 KB Output is correct
8 Correct 39 ms 7260 KB Output is correct
9 Correct 2 ms 4444 KB Output is correct
10 Correct 1 ms 4556 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 1 ms 4528 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 1 ms 4572 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
21 Correct 1 ms 4444 KB Output is correct
22 Correct 1 ms 4444 KB Output is correct
23 Correct 27 ms 6740 KB Output is correct
24 Correct 28 ms 7248 KB Output is correct
25 Correct 65 ms 10324 KB Output is correct
26 Correct 35 ms 8028 KB Output is correct
27 Correct 33 ms 7504 KB Output is correct
28 Correct 64 ms 10712 KB Output is correct
29 Correct 85 ms 10320 KB Output is correct
30 Correct 32 ms 7760 KB Output is correct
31 Correct 67 ms 10764 KB Output is correct