Submission #1194827


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

int n;
ll a[300010];

int main() {
	while(scanf("%d", &n)!=EOF){
        for(int i=0; i<3*n; i++) scanf("%lld", &a[i]);
        sort(a, a+3*n);
        ll sum=0;
        for(
            sum += a[3*n-2-2*i];
        }
        printf("%lld\n", sum);
	}
	return 0;
}

Submission Info

Submission Time
Task A - AtCoder Group Contest
User failed_coder
Language C++14 (GCC 5.4.1)
Score 0
Code Size 357 Byte
Status

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:14:30: error: ‘i’ was not declared in this scope
             sum += a[3*n-2-2*i];
                              ^
./Main.cpp:15:9: error: expected primary-expression before ‘}’ token
         }
         ^
./Main.cpp:15:9: error: expected ‘;’ before ‘}’ token
./Main.cpp:15:9: error: expected primary-expression before ‘}’ token
./Main.cpp:15:9: error: expected ‘)’ before ‘}’ token
./Main.cpp:15:9: error: expected primary-expression before ‘}’ token
./Main.cpp:16:26: error: ‘sum’ was not declared in this scope
         printf("%lld\n", sum);
                          ^
./Main.cpp: At global scope:
./Main.cpp:18:2: error: expected unqualified-id before ‘return’
  return 0;
  ^
./Main.cpp:19:1: error: expected declaration before ‘}’ token
 }
 ^
./Main.cpp: In function ‘int main()’:
./Main.cpp:10:54: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         for(int i=0; i<3*n; i++) sca...