답안 #1032414

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1032414 2024-07-23T17:23:51 Z nguyendinhanh1508 Intercastellar (JOI22_ho_t1) C++14
25 / 100
340 ms 524288 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mx 1000007
#define inf LLONG_MAX/20
#define pi pair<int, int>
#define mp make_pair

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  int a[n];
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  vector<int> vec;
  for(int i = 0; i < n; i++){
    int count = 1;
    while(a[i] % 2 == 0){
      a[i] /= 2;
      count *= 2;
    }
    for(int j = 0; j < count; j++){
      vec.push_back(a[i]);
    }
  }
  int q;
  cin >> q;
  while(q--){
    int x;
    cin >> x;
    if(x - 1 < vec.size()) cout << vec[x - 1] << '\n';
    else cout << "-1\n";
  }
  return 0; 
}

Compilation message

Main.cpp: In function 'int32_t main()':
Main.cpp:35:14: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |     if(x - 1 < vec.size()) cout << vec[x - 1] << '\n';
      |        ~~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 24 ms 6172 KB Output is correct
4 Correct 23 ms 2004 KB Output is correct
5 Correct 30 ms 6352 KB Output is correct
6 Correct 23 ms 9932 KB Output is correct
7 Correct 32 ms 10192 KB Output is correct
8 Correct 37 ms 18424 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Runtime error 340 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 24 ms 6172 KB Output is correct
4 Correct 23 ms 2004 KB Output is correct
5 Correct 30 ms 6352 KB Output is correct
6 Correct 23 ms 9932 KB Output is correct
7 Correct 32 ms 10192 KB Output is correct
8 Correct 37 ms 18424 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Runtime error 340 ms 524288 KB Execution killed with signal 9
12 Halted 0 ms 0 KB -