Submission #237305

# Submission time Handle Problem Language Result Execution time Memory
237305 2020-06-05T20:04:47 Z marlicu Unija (COCI17_unija) C++14
100 / 100
333 ms 22136 KB
#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define X first
#define Y second

const int MAXX = 5e6 + 5;

int n, x, y;
int visina[MAXX];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> x >> y; x/= 2;
        visina[x] = max(visina[x], y);
    }

    long long povrsina = 0;
    int maks = 0;

    for (int i = MAXX - 5; i > 0; i--) {
        //cout << i << " " << povrsina << " " << maks << '\n';
        maks = max(maks, visina[i]);
        povrsina += 2 * maks;
    }

    cout << povrsina;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 14 ms 384 KB Output is correct
2 Correct 16 ms 384 KB Output is correct
3 Correct 14 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 384 KB Output is correct
2 Correct 14 ms 384 KB Output is correct
3 Correct 15 ms 424 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 384 KB Output is correct
2 Correct 15 ms 384 KB Output is correct
3 Correct 17 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 384 KB Output is correct
2 Correct 15 ms 384 KB Output is correct
3 Correct 16 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 333 ms 6888 KB Output is correct
2 Correct 291 ms 6912 KB Output is correct
3 Correct 313 ms 7032 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 512 KB Output is correct
2 Correct 14 ms 384 KB Output is correct
3 Correct 15 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 512 KB Output is correct
2 Correct 21 ms 1024 KB Output is correct
3 Correct 21 ms 896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 37 ms 1024 KB Output is correct
2 Correct 38 ms 2368 KB Output is correct
3 Correct 38 ms 2424 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 96 ms 2304 KB Output is correct
2 Correct 91 ms 6392 KB Output is correct
3 Correct 98 ms 6456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 314 ms 6912 KB Output is correct
2 Correct 297 ms 22008 KB Output is correct
3 Correct 312 ms 22136 KB Output is correct