답안 #873758

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
873758 2023-11-15T16:21:17 Z Alex Intercastellar (JOI22_ho_t1) C++14
35 / 100
2000 ms 20444 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;

int Dos(int n)
{
    return (n & (~(n - 1)));
}

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    map<int,int>m;
    vector<int>v;
    map<int,int>m2;
    int cont = 0;
    for(int i = 0 ; i < n ; i++){
        int a; cin >> a;

        if(!(a & 1)){
        int l = Dos(a);
        cont += l - 1;
        v.push_back(cont);
        if(l == a){
        m[cont] = 1;
        }
        else
        m[cont] = a / l;

        }
        else
        m[cont] = a;

        cont++;
        }
     
    int ms ;
    cin >> ms;
    for(int i = 0 ; i < ms ; i++){
        int k ; cin >> k;
        if(m[k - 1] != 0){
            cout << m[k - 1] << "\n";
            }
        else{
            for(int x : v){
            if(k - 1<= x){
            cout << m[x] << "\n";
            break;
                    }
                }
            }
    }





}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 298 ms 14704 KB Output is correct
4 Correct 292 ms 6728 KB Output is correct
5 Correct 1546 ms 19156 KB Output is correct
6 Correct 1412 ms 15956 KB Output is correct
7 Execution timed out 2007 ms 20444 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 464 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 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 1 ms 348 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 1 ms 600 KB Output is correct
14 Correct 1 ms 604 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 298 ms 14704 KB Output is correct
4 Correct 292 ms 6728 KB Output is correct
5 Correct 1546 ms 19156 KB Output is correct
6 Correct 1412 ms 15956 KB Output is correct
7 Execution timed out 2007 ms 20444 KB Time limit exceeded
8 Halted 0 ms 0 KB -