Submission #62947

# Submission time Handle Problem Language Result Execution time Memory
62947 2018-07-31T03:28:40 Z win11905 Unija (COCI17_unija) C++11
40 / 100
653 ms 66560 KB
#include <bits/stdc++.h>
using namespace std;

#define long long long
#define pii pair<int, int>
#define x first
#define y second

const int N = 1e6+5;

int n;
vector<pii> V, A;

int main() {
    scanf("%d", &n); 
    for(int i = 0, a, b; i < n; ++i) {
        scanf("%d %d", &a, &b);
        V.emplace_back(a >> 1, b >> 1);
    }
    sort(V.begin(), V.end(), [&](const pii &a, const pii &b) {
        if(a.x == b.x) return a.y < b.y;
        return a.x > b.x;
    });
    A.emplace_back(V[0]);
    for(int i = 1; i < n; ++i) {
        if(V[i].y > A.back().y) A.emplace_back(V[i]);
    }
    int pv = 0;
    long sum = 0;
    for(auto x : A) {
        sum += 1ll * x.x * (x.y - pv);
        pv = x.y;
    }
    printf("%lld\n", sum << 2);
}

Compilation message

unija.cpp: In function 'int main()':
unija.cpp:15:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n); 
     ~~~~~^~~~~~~~~~
unija.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &a, &b);
         ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 2 ms 484 KB Output is correct
3 Correct 2 ms 592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 592 KB Output is correct
2 Correct 3 ms 596 KB Output is correct
3 Correct 3 ms 664 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 680 KB Output is correct
2 Correct 3 ms 696 KB Output is correct
3 Correct 3 ms 720 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 876 KB Output is correct
2 Correct 5 ms 1040 KB Output is correct
3 Correct 4 ms 1120 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 546 ms 36204 KB Output is correct
2 Correct 653 ms 51248 KB Output is correct
3 Runtime error 611 ms 66224 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 66224 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 22 ms 66224 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 53 ms 66224 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 157 ms 66224 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 461 ms 66560 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -