Submission #5657857


Source Code Expand

Copy
#include <iostream>
#include <stdio.h>  
using namespace std;
int main(){
    int N,a,b,c;
    int max;
    int A[100];
    a=0;
    b=0;
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    for(int k=0;k<N;k++){
        for(int j=0;j<N;j++){
            if(j==0){
                max=A[j];
                c=0;
            }
            if(max<=A[j]){
                max=A[j];
                c=j;
            }
        }
        A[c]=0;
        if(k%2==0){
            a = a+max;
        }
        else{
            b = b+max;
        }
    }
    cout << a-b <<endl;
}

Submission Info

Submission Time
Task ABC088B - Card Game for Two
User hexa0611
Language C++14 (Clang 3.8.0)
Score 200
Code Size 622 Byte
Status
Exec Time 1 ms
Memory 256 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_1.txt, sample_2.txt, sample_3.txt
All 200 / 200 in1.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, in9.txt, sample_1.txt, sample_2.txt, sample_3.txt
Case Name Status Exec Time Memory
in1.txt 1 ms 256 KB
in2.txt 1 ms 256 KB
in3.txt 1 ms 256 KB
in4.txt 1 ms 256 KB
in5.txt 1 ms 256 KB
in6.txt 1 ms 256 KB
in7.txt 1 ms 256 KB
in8.txt 1 ms 256 KB
in9.txt 1 ms 256 KB
sample_1.txt 1 ms 256 KB
sample_2.txt 1 ms 256 KB
sample_3.txt 1 ms 256 KB