結果
| 問題 | No.1374 Absolute Game |
| コンテスト | |
| ユーザー |
tempura_pp
|
| 提出日時 | 2019-03-24 02:09:25 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 371 bytes |
| 記録 | |
| コンパイル時間 | 1,593 ms |
| コンパイル使用メモリ | 169,900 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-02 10:08:35 |
| 合計ジャッジ時間 | 3,303 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | AC * 23 WA * 3 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
int main(){
int n;
cin>>n;
ll a[n];
rep(i,n)cin>>a[i];
sort(a,a+n);
ll ans=0;
rep(i,n){
if(i%2)ans-=a[i];
else ans+=a[i];
}
cout<<abs(ans)<<endl;
return 0;
}
tempura_pp