Submission #23088

# Submission time Handle Problem Language Result Execution time Memory
23088 2017-05-02T17:29:11 Z model_code Unija (COCI17_unija) C++11
100 / 100
353 ms 21712 KB
#include <iostream>
using namespace std;

const int MAX_X = 5 * 1000 * 1000;
int h[MAX_X + 2];

int main() {
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int x, y;
        cin >> x >> y;
        if (h[x / 2] < y)
            h[x / 2] = y;
    }
    long long p = 0;
    for (int i = MAX_X; i > 0; --i) {
        if (h[i] < h[i + 1])
            h[i] = h[i + 1];
        p += h[i];
    }
    cout << 2 * p << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 21712 KB Output is correct
2 Correct 3 ms 21712 KB Output is correct
3 Correct 6 ms 21712 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 21712 KB Output is correct
2 Correct 3 ms 21712 KB Output is correct
3 Correct 3 ms 21712 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 21712 KB Output is correct
2 Correct 6 ms 21712 KB Output is correct
3 Correct 6 ms 21712 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 21712 KB Output is correct
2 Correct 3 ms 21712 KB Output is correct
3 Correct 6 ms 21712 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 339 ms 21712 KB Output is correct
2 Correct 286 ms 21712 KB Output is correct
3 Correct 353 ms 21712 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 21712 KB Output is correct
2 Correct 3 ms 21712 KB Output is correct
3 Correct 6 ms 21712 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 21712 KB Output is correct
2 Correct 9 ms 21712 KB Output is correct
3 Correct 13 ms 21712 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 29 ms 21712 KB Output is correct
2 Correct 29 ms 21712 KB Output is correct
3 Correct 33 ms 21712 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 89 ms 21712 KB Output is correct
2 Correct 86 ms 21712 KB Output is correct
3 Correct 89 ms 21712 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 349 ms 21712 KB Output is correct
2 Correct 346 ms 21712 KB Output is correct
3 Correct 329 ms 21712 KB Output is correct