Task: | Greedy Game |
Sender: | Laakeri |
Submission time: | 2016-07-27 19:54:20 +0300 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | RUNTIME ERROR | 0 |
test | verdict | time | |
---|---|---|---|
#1 | RUNTIME ERROR | 0.18 s | details |
#2 | RUNTIME ERROR | 0.18 s | details |
#3 | RUNTIME ERROR | 0.20 s | details |
#4 | RUNTIME ERROR | 0.21 s | details |
#5 | RUNTIME ERROR | 0.18 s | details |
#6 | RUNTIME ERROR | 0.18 s | details |
#7 | RUNTIME ERROR | 0.22 s | details |
#8 | RUNTIME ERROR | 0.19 s | details |
#9 | RUNTIME ERROR | 0.18 s | details |
#10 | RUNTIME ERROR | 0.17 s | details |
#11 | RUNTIME ERROR | 0.17 s | details |
#12 | RUNTIME ERROR | 0.22 s | details |
#13 | RUNTIME ERROR | 0.21 s | details |
#14 | RUNTIME ERROR | 0.21 s | details |
#15 | RUNTIME ERROR | 0.27 s | details |
#16 | RUNTIME ERROR | 0.18 s | details |
#17 | RUNTIME ERROR | 0.23 s | details |
#18 | RUNTIME ERROR | 0.22 s | details |
#19 | RUNTIME ERROR | 0.19 s | details |
#20 | RUNTIME ERROR | 0.20 s | details |
#21 | RUNTIME ERROR | 0.17 s | details |
#22 | RUNTIME ERROR | 0.17 s | details |
#23 | RUNTIME ERROR | 0.17 s | details |
#24 | RUNTIME ERROR | 0.18 s | details |
#25 | RUNTIME ERROR | 0.18 s | details |
#26 | RUNTIME ERROR | 0.18 s | details |
#27 | RUNTIME ERROR | 0.17 s | details |
#28 | RUNTIME ERROR | 0.20 s | details |
#29 | RUNTIME ERROR | 0.17 s | details |
#30 | RUNTIME ERROR | 0.21 s | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:57:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (s.size() < (i + 1) / 2) { ^ input/code.cpp:42:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &n); ^ input/code.cpp:45:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &a[i].first); ^ input/code.cpp:49:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &a[i].second); ^
Code
#include <stdlib.h> #include <string.h> #if ( _WIN32 || __WIN32__ || _WIN64 || __WIN64__ ) #define INT64 "%I64d" #else #define INT64 "%lld" #endif #if ( _WIN32 || __WIN32__ || _WIN64 || __WIN64__ ) #define UNS64 "%I64u" #else #define UNS64 "%llu" #endif /** * Author: Igor Labutin (Labutin.IgorL@gmail.com) */ #include <cstdio> #include <cassert> #include <algorithm> #include <set> using namespace std; typedef long long ll; #define forn(i, n) for (int i = 0; i < (int)(n); i++) #define forlr(i, l, r) for (int i = (int)(l); i <= (int)(r); i++) const int MAXN = 200000; pair <int, int> a[MAXN]; int n; bool cmp(pair <int, int> x, pair <int, int> y) { return x.first > y.first || (x.first == y.first && x.second > y.second); } int main() { #define NAME "game" assert(freopen(NAME ".in", "r", stdin)); assert(freopen(NAME ".out", "w", stdout)); scanf("%d", &n); forn(i, n) { scanf("%d", &a[i].first); } forn(i, n) { scanf("%d", &a[i].second); } sort(a, a + n, cmp); multiset <int> s; forn(i, n) { if (s.size() < (i + 1) / 2) { s.insert(a[i].second); } else { if (s.size() != 0 && *s.begin() < a[i].second) { s.erase(s.begin()); s.insert(a[i].second); } } } ll res = 0; for (auto it = s.begin(); it != s.end(); ++it) { res += *it; } printf(INT64 "\n", res); return 0; }
Test details
Test 1
Verdict: RUNTIME ERROR
input |
---|
5 1 2 3 4 5 2 3 4 5 6 |
correct output |
---|
8 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.
Test 2
Verdict: RUNTIME ERROR
input |
---|
10 1 1 1 1 1 1 1 1 1 1 2 3 9 5 6 6 1 2 3 4 |
correct output |
---|
17 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.
Test 3
Verdict: RUNTIME ERROR
input |
---|
15 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
correct output |
---|
7 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.
Test 4
Verdict: RUNTIME ERROR
input |
---|
15 2 4 2 8 6 6 5 6 4 10 9 3 10 7 ... |
correct output |
---|
60 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.
Test 5
Verdict: RUNTIME ERROR
input |
---|
15 3 8 6 9 1 5 1 9 3 10 1 10 9 8 ... |
correct output |
---|
47 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.
Test 6
Verdict: RUNTIME ERROR
input |
---|
15 2 6 4 9 8 3 8 7 1 8 8 7 5 6 8 7 6 4 9 3 8 9 5 3 10 2 2 4 6 3 |
correct output |
---|
46 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.
Test 7
Verdict: RUNTIME ERROR
input |
---|
15 7 10 8 8 6 10 5 1 7 3 9 4 7 9 ... |
correct output |
---|
56 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.
Test 8
Verdict: RUNTIME ERROR
input |
---|
15 9 8 7 7 4 6 4 10 3 7 5 9 5 9 5 3 6 7 2 9 8 3 3 7 5 6 7 9 3 8 |
correct output |
---|
55 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.
Test 9
Verdict: RUNTIME ERROR
input |
---|
15 684567283 992849846 97315816 3... |
correct output |
---|
5346487014 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.
Test 10
Verdict: RUNTIME ERROR
input |
---|
15 220108915 735849670 3920201 84... |
correct output |
---|
4369763599 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.
Test 11
Verdict: RUNTIME ERROR
input |
---|
15 428748595 949568430 413698361 ... |
correct output |
---|
5262225140 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.
Test 12
Verdict: RUNTIME ERROR
input |
---|
15 310486323 634006126 326650297 ... |
correct output |
---|
5825473032 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.
Test 13
Verdict: RUNTIME ERROR
input |
---|
15 865322099 789162758 742776009 ... |
correct output |
---|
5028684388 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.
Test 14
Verdict: RUNTIME ERROR
input |
---|
100000 1 5 7 1 6 8 1 7 9 2 7 7 6 1 8 ... |
correct output |
---|
387044 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.
Test 15
Verdict: RUNTIME ERROR
input |
---|
100000 10 6 1 4 1 8 5 4 8 10 5 8 7 5 ... |
correct output |
---|
388046 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.
Test 16
Verdict: RUNTIME ERROR
input |
---|
100000 6 1 1 6 7 8 10 6 7 6 8 7 6 5 3... |
correct output |
---|
387631 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.
Test 17
Verdict: RUNTIME ERROR
input |
---|
100000 9 2 5 7 5 8 5 3 4 10 5 6 10 2 ... |
correct output |
---|
387600 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.
Test 18
Verdict: RUNTIME ERROR
input |
---|
100000 8 7 4 7 3 6 2 6 1 2 7 5 1 5 5 ... |
correct output |
---|
387928 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.
Test 19
Verdict: RUNTIME ERROR
input |
---|
100000 329395763 605200206 806179577 ... |
correct output |
---|
37487670627833 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.
Test 20
Verdict: RUNTIME ERROR
input |
---|
100000 595917875 55389390 744521721 4... |
correct output |
---|
37446270419509 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.
Test 21
Verdict: RUNTIME ERROR
input |
---|
100000 535538034 976297510 186037641 ... |
correct output |
---|
37452666188784 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.
Test 22
Verdict: RUNTIME ERROR
input |
---|
100000 148256243 367924566 130727336 ... |
correct output |
---|
37441139105851 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.
Test 23
Verdict: RUNTIME ERROR
input |
---|
100000 434072499 230270558 578590809 ... |
correct output |
---|
37528719082827 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.
Test 24
Verdict: RUNTIME ERROR
input |
---|
100000 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
correct output |
---|
375239 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.
Test 25
Verdict: RUNTIME ERROR
input |
---|
100000 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
correct output |
---|
37477679133533 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.
Test 26
Verdict: RUNTIME ERROR
input |
---|
100000 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
correct output |
---|
375514 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.
Test 27
Verdict: RUNTIME ERROR
input |
---|
100000 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
correct output |
---|
37505905982098 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.
Test 28
Verdict: RUNTIME ERROR
input |
---|
100000 100000 100000 100000 100000 10... |
correct output |
---|
5000000000 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.
Test 29
Verdict: RUNTIME ERROR
input |
---|
100000 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
correct output |
---|
2500000000 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.
Test 30
Verdict: RUNTIME ERROR
input |
---|
100000 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
correct output |
---|
3750025000 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:39: int main(): Assertion `freopen("game" ".in", "r", stdin)' failed.