답안 #1032413

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1032413 2024-07-23T17:22:58 Z nguyendinhanh1508 Intercastellar (JOI22_ho_t1) C++17
25 / 100
337 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

int a[mx];

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> 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:36: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]
   36 |     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 16 ms 6804 KB Output is correct
4 Correct 20 ms 3032 KB Output is correct
5 Correct 31 ms 8124 KB Output is correct
6 Correct 23 ms 10444 KB Output is correct
7 Correct 34 ms 10828 KB Output is correct
8 Correct 41 ms 19148 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Runtime error 337 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 16 ms 6804 KB Output is correct
4 Correct 20 ms 3032 KB Output is correct
5 Correct 31 ms 8124 KB Output is correct
6 Correct 23 ms 10444 KB Output is correct
7 Correct 34 ms 10828 KB Output is correct
8 Correct 41 ms 19148 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Runtime error 337 ms 524288 KB Execution killed with signal 9
12 Halted 0 ms 0 KB -