답안 #847865

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
847865 2023-09-10T16:26:27 Z vjudge1 Unija (COCI17_unija) C
100 / 100
193 ms 20052 KB
#include <stdio.h>

int main() {
    int n;
    scanf("%d", &n);

    int heights[5000006] = {0};

    for (int i = 0; i < n; ++i) {
        int x, y;
        scanf("%d %d", &x, &y);
        if (heights[x / 2] < y) {
            heights[x / 2] = y;
        }
    }

    long long res = 0;
    for (int i = 5000000; i > 0; --i) {
        if (heights[i] < heights[i + 1]) {
            heights[i] = heights[i + 1];
        }
        res += heights[i];
    }

    printf("%lld\n", res << 1);

    return 0;
}

Compilation message

unija.c: In function 'main':
unija.c:5:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 |     scanf("%d", &n);
      |     ^~~~~~~~~~~~~~~
unija.c:11:9: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         scanf("%d %d", &x, &y);
      |         ^~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 19772 KB Output is correct
2 Correct 16 ms 19800 KB Output is correct
3 Correct 17 ms 19800 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 19800 KB Output is correct
2 Correct 16 ms 19800 KB Output is correct
3 Correct 16 ms 19800 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 19800 KB Output is correct
2 Correct 15 ms 19800 KB Output is correct
3 Correct 20 ms 19804 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 19800 KB Output is correct
2 Correct 15 ms 19800 KB Output is correct
3 Correct 16 ms 19800 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 188 ms 20052 KB Output is correct
2 Correct 171 ms 19800 KB Output is correct
3 Correct 168 ms 19800 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 19800 KB Output is correct
2 Correct 15 ms 19800 KB Output is correct
3 Correct 15 ms 19800 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 19800 KB Output is correct
2 Correct 19 ms 19804 KB Output is correct
3 Correct 20 ms 19800 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 19800 KB Output is correct
2 Correct 30 ms 19804 KB Output is correct
3 Correct 28 ms 19800 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 62 ms 19800 KB Output is correct
2 Correct 55 ms 19800 KB Output is correct
3 Correct 55 ms 19956 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 157 ms 19800 KB Output is correct
2 Correct 168 ms 19800 KB Output is correct
3 Correct 193 ms 19956 KB Output is correct