답안 #702629

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
702629 2023-02-24T15:51:43 Z Chal1shkan Intercastellar (JOI22_ho_t1) C++14
35 / 100
18 ms 1360 KB
# include <bits/stdc++.h>
 
# define pb push_back
# define ff first
# define ss second
# define nl "\n"
# define sz(x) ((int)(x).size())
# define deb(x) cerr << #x  << " = " << x << endl; 
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
 
const ll maxn = 1e5 + 25;
const ll inf = 2e9 + 0;
const ll mod = 998244353;
const ll dx[] = {-1, 1, 0, 0};
const ll dy[] = {0, 0, -1, 1};
 
using namespace std;

ll n, q, a[maxn];

void ma1n (/* SABR */)
{
	cin >> n;
	for (ll i = 1; i <= n; ++i)
	{
		cin >> a[i];
	}
	cin >> q;
	while (q--)
	{
		ll w;
		cin >> w;
		ll cnt = 0;
		for (ll i = 1; i <= n; ++i)
		{
			ll x = a[i];
			ll c = 1;
			while (x % 2 == 0)
			{
				c *= 2;
				x /= 2;
			}
			cnt += c;
			if (cnt >= w)
			{
				cout << x << nl;
				break;
			}
		}
	}
}
 
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
//    freopen("angry.in", "r", stdin);
//    freopen("angry.out", "w", stdout);
    int ttt = 1;
//  cin >> ttt;
    for (int test = 1; test <= ttt; ++test)
    {
//      cout << "Case " << test << ":" << ' ';
        ma1n();
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Incorrect 5 ms 1360 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 328 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 2 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 12 ms 360 KB Output is correct
12 Correct 18 ms 352 KB Output is correct
13 Correct 4 ms 340 KB Output is correct
14 Correct 15 ms 372 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Incorrect 5 ms 1360 KB Output isn't correct
4 Halted 0 ms 0 KB -