Submission #847865

#TimeUsernameProblemLanguageResultExecution timeMemory
847865vjudge1Unija (COCI17_unija)C11
100 / 100
193 ms20052 KiB
#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 (stderr)

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);
      |         ^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...