Submission #154214

# Submission time Handle Problem Language Result Execution time Memory
154214 2019-09-19T10:47:56 Z KCSC Akcija (COCI15_akcija) C++14
0 / 80
2 ms 380 KB
#include <bits/stdc++.h>
using namespace std;

const int DIM = 100005;

int arr[DIM];

int main(void) {
    freopen("b.in", "r", stdin);
    freopen("b.out", "w", stdout);
    int n;
    cin >> n;
    long long ans = 0;
    for (int i = 1; i <= n; ++i) {
        cin >> arr[i];
        ans += arr[i];
    }
    sort(arr + 1, arr + n + 1);
    for (int i = n - 2; i >= 1; i -= 3)
        ans -= arr[i];
    cout << ans;
    return 0;
}

Compilation message

akcija.cpp: In function 'int main()':
akcija.cpp:9:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("b.in", "r", stdin);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~
akcija.cpp:10:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("b.out", "w", stdout);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Incorrect 2 ms 256 KB Output isn't correct
3 Incorrect 2 ms 256 KB Output isn't correct
4 Incorrect 2 ms 256 KB Output isn't correct
5 Incorrect 2 ms 376 KB Output isn't correct
6 Incorrect 2 ms 256 KB Output isn't correct
7 Incorrect 2 ms 380 KB Output isn't correct
8 Incorrect 2 ms 376 KB Output isn't correct
9 Incorrect 2 ms 376 KB Output isn't correct
10 Incorrect 2 ms 376 KB Output isn't correct