답안 #1017899

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1017899 2024-07-09T11:13:58 Z ag_1204 Intercastellar (JOI22_ho_t1) C++14
35 / 100
2000 ms 8588 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define pii pair<int,int>
#define vi vector<int>
#define si set<int>
#define pb push_back

int low(vector<int> v,int k) {
    vector<int>::iterator t=lower_bound(v.begin(),v.end(),k);
    int ind=t-v.begin();
    return ind;
}

void solve() {
    int n; cin>>n;
    int a[n];
    vector<pii> nums(n);
    vi sums(n);
    int sum=0;
    for (int i=0;i<n;i++) {
        cin>>a[i];
        int m=1;
        while(a[i]%2==0) {
            m*=2;
            a[i]/=2;
        }
        pair<int,int> p; p.first=a[i]; p.second=m;
        nums[i]=p;
        sum+=m;
        sums[i]=sum;
    }
    int q; cin>>q;
    while(q--) {
        int x; cin>>x;
        int i=low(sums,x);
        cout<<nums[i].first<<endl;
    }
    return;
}

int32_t main() {
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int tt=1; //cin>>tt;
	while(tt--) {
	    solve();
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Execution timed out 2096 ms 8588 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 360 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 452 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 2 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 464 KB Output is correct
12 Correct 3 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 2 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Execution timed out 2096 ms 8588 KB Time limit exceeded
4 Halted 0 ms 0 KB -