結果
問題 | No.2835 Take and Flip |
ユーザー |
![]() |
提出日時 | 2024-09-28 15:35:12 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 41 ms / 2,000 ms |
コード長 | 1,015 bytes |
コンパイル時間 | 2,078 ms |
コンパイル使用メモリ | 207,660 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-09-28 15:35:17 |
合計ジャッジ時間 | 4,896 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef vector<int> vi; #define RIDLs_code ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define fi1(x) for(int i=1;i<=x;++i) #define fi0(x) for(int i=0;i<x;++i) #define fj0(x) for(int j=0;j<x;++j) #define fj1(x) for(int j=1;j<=x;++j) #define For(elem, begin, end) for(int elem=begin;elem<end;++elem) #define RFor(elem, begin, end) for(int elem=begin;elem>=end;--elem) #define all(x) (x).begin(), (x).end() #define pb push_back const int MOD = 1e9+7; const int INF = 0x3f3f3f3f; void solve(){ int n; cin>>n; vector<ll> a(n); deque<ll> aa; ll tmp; int op=1; ll x=0, y=0; fi0(n){ cin>>a[i]; // a.push_back } sort(all(a)); fi0(n/2){ // op*=-1; y+=a[i]*(-1LL*1); } For(i, n/2, n){ x+=a[i]; } cout<<x-y<<endl; return; } int main(){ RIDLs_code int T=1; // cin>>T; while (T--) solve(); return 0; }