結果
| 問題 |
No.904 サメトロ
|
| コンテスト | |
| ユーザー |
Nagisa
|
| 提出日時 | 2019-10-12 02:25:24 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 609 bytes |
| コンパイル時間 | 2,297 ms |
| コンパイル使用メモリ | 178,352 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-26 07:34:50 |
| 合計ジャッジ時間 | 7,196 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | AC * 2 WA * 7 RE * 24 |
ソースコード
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N;
vector<int> A(N+1,0), B(N+1,0);
cin >> N;
REP(i,N-1){
cin >> A[i] >> B[i];
}
int s = accumulate(ALL(A), 0);
int t = accumulate(ALL(B), 0);
int ma = 0, mb = 0;
REP(i,N-1){
ma = max(ma, A[i]+B[i]-s);
mb = max(mb, A[i]+B[i]-t);
}
cout << min(t-ma,s-mb) + 1 << endl;
return 0;
}
Nagisa