이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#pragma gcc optimize('ofast','unroll-loops')
#define endl '\n'
#define ff first
#define ss second
#define pb emplace_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define rep(a,b,c) for(int a=b;a<c;a++)
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
const ll maxn = 100005;
const ll maxm = 200005;
const ll mod = 1000000007;
void solve(){
ll n, q;
ll a; vector<pair<ll,ll>> vc;
cin >> n;
rep(i,0,n){
cin >> a;
rep(i,0,100){
if(a%2){
vc.pb(mp(vc.size()?vc.back().ff+(1ll<<i):(1ll<<i),a));
break;
}else a /= 2;
}
}
cin >> q;
while(q--){
cin >> a;
cout << lower_bound(all(vc),mp(a,0ll))->ss << endl;
}
}
int main(){
//freopen("input.txt","r",stdin);
//freopen("sol.txt","w",stdout);
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int t = 1;
//cin >> t;
while(t--) solve();
}
컴파일 시 표준 에러 (stderr) 메시지
Main.cpp:4: warning: ignoring '#pragma gcc optimize' [-Wunknown-pragmas]
4 | #pragma gcc optimize('ofast','unroll-loops')
|
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |