답안 #881950

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
881950 2023-12-02T10:13:17 Z hennessey Intercastellar (JOI22_ho_t1) C++17
35 / 100
2000 ms 6088 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long

signed main() {
    //your code goes here
    int n;
    cin >> n;
    vector <pair <int, int>> arr = {};
    for(int i = 0; i < n; i++) {
        int num;
        cin >> num;
        int val = 1;
        // cout << num << " b " << endl;
        while(num%2 == 0) {
            val *= 2;
            num /= 2;
        }
        // cout << num << " v " << endl;
        arr.push_back({num, val});
    }
    int q;
    cin >> q;
    for(int i = 0; i < q; i++) {
        int x;
        cin >> x;
        int val = 0;
        for(int i = 0; i < arr.size(); i++) {
            val += arr[i].second;
            if(val >= x) {
                cout << arr[i].first << endl;
                break;
            }
        }
    }
    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:30:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |         for(int i = 0; i < arr.size(); i++) {
      |                        ~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1804 ms 6088 KB Output is correct
4 Execution timed out 2055 ms 1760 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 432 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 2 ms 348 KB Output is correct
9 Correct 1 ms 440 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 2 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 2 ms 348 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 Correct 1804 ms 6088 KB Output is correct
4 Execution timed out 2055 ms 1760 KB Time limit exceeded
5 Halted 0 ms 0 KB -