답안 #548680

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
548680 2022-04-14T08:37:44 Z cpp219 Intercastellar (JOI22_ho_t1) C++17
100 / 100
81 ms 10736 KB
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define fs first
#define sc second
#define debug(y) cout<<y,exit(0)
using namespace std;
typedef pair<ll,ll> LL;
const ll N = 2e5 + 9;
const ll inf = 1e18 + 7;

ll n,Q,x,a[N],q[N],ans[N];
vector<ll> v;

int main(){
    ios_base::sync_with_stdio(NULL); cin.tie(0); cout.tie(0);
    #define task "test"
    if (fopen(task".inp","r")){
        freopen(task".inp","r",stdin);
        //freopen(task".out","w",stdout);
    }
    cin>>n;
    for (ll i = 1;i <= n;i++) cin>>a[i];
    cin>>Q;
    for (ll i = 1;i <= Q;i++) cin>>q[i];
    ll nth = 0,cur = 1;
    for (ll i = 1;i <= n;i++){
        ll cnt = 1;
        while(a[i]%2 == 0) a[i] /= 2,cnt *= 2;
        nth += cnt;
        while(q[cur] <= nth && cur <= Q) ans[cur] = a[i],cur++;
    }
    //debug(nth);
    for (ll i = 1;i <= Q;i++) cout<<ans[i]<<"\n";
}
/// be confident

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:19:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |         freopen(task".inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 18 ms 3108 KB Output is correct
4 Correct 24 ms 4308 KB Output is correct
5 Correct 42 ms 7120 KB Output is correct
6 Correct 27 ms 4248 KB Output is correct
7 Correct 46 ms 7024 KB Output is correct
8 Correct 40 ms 7132 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 324 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 18 ms 3108 KB Output is correct
4 Correct 24 ms 4308 KB Output is correct
5 Correct 42 ms 7120 KB Output is correct
6 Correct 27 ms 4248 KB Output is correct
7 Correct 46 ms 7024 KB Output is correct
8 Correct 40 ms 7132 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 0 ms 324 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 24 ms 4684 KB Output is correct
24 Correct 31 ms 5448 KB Output is correct
25 Correct 69 ms 10288 KB Output is correct
26 Correct 45 ms 6200 KB Output is correct
27 Correct 40 ms 5692 KB Output is correct
28 Correct 67 ms 10736 KB Output is correct
29 Correct 71 ms 10196 KB Output is correct
30 Correct 44 ms 5964 KB Output is correct
31 Correct 81 ms 10656 KB Output is correct