Submission #708982

# Submission time Handle Problem Language Result Execution time Memory
708982 2023-03-13T03:31:20 Z vjudge1 Akcija (COCI15_akcija) C++17
0 / 80
186 ms 47716 KB
#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
using namespace std;
int main() {
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ll n;
    cin>>n;
    ll a[n],s=0,x=0;
    for(int i=0;i<n;i++){cin>>a[i];s+=a[i];}
    sort(a,a+n);
    reverse(a,a+n);
    for(int i=2;i<n;i+=3)x+=a[i];
    cout<<s-x;
    return 0;
}

Compilation message

akcija.cpp: In function 'int main()':
akcija.cpp:11:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         freopen("input.txt", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
akcija.cpp:12:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         freopen("output.txt", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 162 ms 47700 KB Memory limit exceeded
2 Runtime error 161 ms 47712 KB Memory limit exceeded
3 Runtime error 178 ms 47716 KB Memory limit exceeded
4 Runtime error 166 ms 47708 KB Memory limit exceeded
5 Runtime error 168 ms 47712 KB Memory limit exceeded
6 Runtime error 176 ms 47700 KB Memory limit exceeded
7 Runtime error 186 ms 47704 KB Memory limit exceeded
8 Runtime error 178 ms 47712 KB Memory limit exceeded
9 Runtime error 177 ms 47716 KB Memory limit exceeded
10 Runtime error 174 ms 47700 KB Memory limit exceeded