답안 #847796

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
847796 2023-09-10T12:29:31 Z StefanSebez Intercastellar (JOI22_ho_t1) C++14
100 / 100
81 ms 10836 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n;
    scanf("%lld",&n);
    ll a[n+1],b[n+1],pref[n+1]={0};
    for(int i=1;i<=n;i++)
	{
		b[i]=1;
		scanf("%lld",&a[i]);
		while(a[i]%2==0){b[i]*=2;a[i]/=2;}
		pref[i]=pref[i-1]+b[i];
	}
    ll q;
    scanf("%lld",&q);
    while(q--)
	{
		ll x;
		scanf("%lld",&x);
		ll lb=lower_bound(pref+1,pref+n+1,x)-pref;
		printf("%lld\n",a[lb]);
	}
    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     scanf("%lld",&n);
      |     ~~~~~^~~~~~~~~~~
Main.cpp:12:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |   scanf("%lld",&a[i]);
      |   ~~~~~^~~~~~~~~~~~~~
Main.cpp:17:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |     scanf("%lld",&q);
      |     ~~~~~^~~~~~~~~~~
Main.cpp:21:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |   scanf("%lld",&x);
      |   ~~~~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 23 ms 5576 KB Output is correct
4 Correct 33 ms 2652 KB Output is correct
5 Correct 58 ms 6992 KB Output is correct
6 Correct 35 ms 5468 KB Output is correct
7 Correct 59 ms 7012 KB Output is correct
8 Correct 61 ms 7248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 23 ms 5576 KB Output is correct
4 Correct 33 ms 2652 KB Output is correct
5 Correct 58 ms 6992 KB Output is correct
6 Correct 35 ms 5468 KB Output is correct
7 Correct 59 ms 7012 KB Output is correct
8 Correct 61 ms 7248 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 29 ms 3400 KB Output is correct
24 Correct 33 ms 6228 KB Output is correct
25 Correct 68 ms 10312 KB Output is correct
26 Correct 46 ms 6460 KB Output is correct
27 Correct 42 ms 6636 KB Output is correct
28 Correct 76 ms 10836 KB Output is correct
29 Correct 73 ms 10264 KB Output is correct
30 Correct 38 ms 3844 KB Output is correct
31 Correct 81 ms 10836 KB Output is correct