Submission #1090105


Source Code Expand

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
 
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl
 
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
template<class T> using vv=vector<vector< T > >;

int main() {
  int n;
  scanf("%d", &n);
  vi a(n);
  rep (i, n) {
    scanf("%d", &a[i]);
  }
  sort(all(a), greater<>());
  int ans = 0;
  for (int i = 0; i < n; i += 2) {
    ans += a[i];
  }
  printf("%d\n", ans);
  return 0;
}

Submission Info

Submission Time
Task A - カードと兄妹
User tspcx
Language C++14 (Clang++ 3.4)
Score 100
Code Size 1144 Byte
Status AC
Exec Time 19 ms
Memory 928 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 2
AC × 11
Set Name Test Cases
Sample sample-01.txt, sample-02.txt
All 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt
Case Name Status Exec Time Memory
01-01.txt AC 19 ms 792 KB
01-02.txt AC 17 ms 928 KB
01-03.txt AC 17 ms 928 KB
01-04.txt AC 17 ms 800 KB
01-05.txt AC 17 ms 796 KB
01-06.txt AC 19 ms 800 KB
01-07.txt AC 17 ms 800 KB
01-08.txt AC 17 ms 796 KB
01-09.txt AC 17 ms 836 KB
01-10.txt AC 19 ms 800 KB
01-11.txt AC 18 ms 924 KB
sample-01.txt AC 19 ms 796 KB
sample-02.txt AC 17 ms 792 KB