답안 #741675

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
741675 2023-05-14T14:17:29 Z jongjip Intercastellar (JOI22_ho_t1) C
35 / 100
2000 ms 7108 KB
#include <stdio.h>
#define max(a, b) (((a)>(b))?(a):(b))

#define _CRT_SECURE_NO_WARNINGS
#pragma warning(disable: 4996)

unsigned long long a[1020406];
unsigned long long x[1020406];
unsigned long long aa[1020406];

int main() {
    int n,q,j;
    unsigned long long count = 0;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%lld", &a[i]);
    }
    scanf("%d", &q);
    for (int i = 0; i < q; i++) {
        scanf("%lld", &x[i]);
    }
    for (int i = 0; i < n; i++) {
        unsigned long long temp = 1;
        aa[i] = 1;
        while (a[i] % 2 == 0) {
            a[i] = a[i] / 2;
            temp*=2;
        }
        count = count + temp;
        aa[i] = count;
    }
    
    for (int i = 0; i < q; i++) {
        j = 0;
        while (x[i] > aa[j]) {
            j++;
        }
        printf("%llu \n",a[j]);
    }
}

Compilation message

Main.c:5: warning: ignoring '#pragma warning ' [-Wunknown-pragmas]
    5 | #pragma warning(disable: 4996)
      | 
Main.c: In function 'main':
Main.c:14:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     scanf("%d", &n);
      |     ^~~~~~~~~~~~~~~
Main.c:16:9: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         scanf("%lld", &a[i]);
      |         ^~~~~~~~~~~~~~~~~~~~
Main.c:18:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |     scanf("%d", &q);
      |     ^~~~~~~~~~~~~~~
Main.c:20:9: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |         scanf("%lld", &x[i]);
      |         ^~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1439 ms 4392 KB Output is correct
4 Correct 1366 ms 3700 KB Output is correct
5 Execution timed out 2076 ms 7108 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 292 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 292 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 300 KB Output is correct
12 Correct 1 ms 300 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1439 ms 4392 KB Output is correct
4 Correct 1366 ms 3700 KB Output is correct
5 Execution timed out 2076 ms 7108 KB Time limit exceeded
6 Halted 0 ms 0 KB -