Submission #153730

#TimeUsernameProblemLanguageResultExecution timeMemory
153730BabinSinkoAkcija (COCI15_akcija)C++14
80 / 80
66 ms2424 KiB
#include <cstdio> #include <cstdlib> #include <cmath> #include <iostream> #include <cctype> #include <ctime> using namespace std; long long n, c[100003], sol, x; int compare (const void * a, const void * b){ return ( *(int*)a - *(int*)b ); } int main(){ cin >> n; for (int i; i < n; i++){ cin >> c[i]; sol = sol + c[i]; } x = 1; qsort (c, n, sizeof(long long), compare); for (int i = (n - 1); i >= 0; i--){ if (x % 3 == 0){ sol = sol - c[i]; x = 0; } x = x + 1; } cout << sol; return 0; }

Compilation message (stderr)

akcija.cpp: In function 'int main()':
akcija.cpp:17:15: warning: 'i' is used uninitialized in this function [-Wuninitialized]
 for (int i; i < n; i++){
             ~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...