제출 #966935

#제출 시각아이디문제언어결과실행 시간메모리
966935resfastIntercastellar (JOI22_ho_t1)C++17
100 / 100
85 ms10764 KiB
	#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
	}
	
	
	
	
	
	
	
	

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp:37:3: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   37 |   main(){
      |   ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...