結果
問題 | No.999 てん vs. ほむ |
ユーザー | ui_mtc |
提出日時 | 2020-03-30 14:41:10 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 573 bytes |
コンパイル時間 | 1,840 ms |
コンパイル使用メモリ | 166,668 KB |
実行使用メモリ | 4,904 KB |
最終ジャッジ日時 | 2023-09-02 21:58:53 |
合計ジャッジ時間 | 3,952 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,368 KB |
testcase_01 | AC | 2 ms
4,372 KB |
testcase_02 | AC | 1 ms
4,368 KB |
testcase_03 | AC | 2 ms
4,372 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 1 ms
4,372 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | AC | 50 ms
4,372 KB |
testcase_18 | AC | 49 ms
4,372 KB |
testcase_19 | AC | 51 ms
4,372 KB |
testcase_20 | AC | 51 ms
4,372 KB |
testcase_21 | AC | 75 ms
4,564 KB |
testcase_22 | AC | 73 ms
4,512 KB |
ソースコード
#include <bits/stdc++.h> #define int long long using namespace std; using Graph = vector<vector<int>>; signed main(){ int N; cin >> N; vector<int> A(2*N); for( int i = 0; i < 2*N; i++ ) cin >> A.at(i); int homu = 0; int tenn = 0; int r = 2*N-1; int l = 0; while( l < r ){ int migi = A.at(r)-A.at(r-1); int hidari = A.at(l)-A.at(l+1); if( migi > hidari ){ homu += A.at(r); tenn += A.at(r-1); r-= 2; }else{ homu += A.at(l); tenn += A.at(l+1); l += 2; } } cout << homu-tenn << endl; }