結果
| 問題 |
No.904 サメトロ
|
| コンテスト | |
| ユーザー |
ngtkana
|
| 提出日時 | 2020-03-09 14:20:57 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 1,000 ms |
| コード長 | 441 bytes |
| コンパイル時間 | 1,759 ms |
| コンパイル使用メモリ | 168,008 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-07 23:11:18 |
| 合計ジャッジ時間 | 2,967 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 33 |
ソースコード
#include<bits/stdc++.h>
#define endl enjoy_codeforces
int main(){
int n;std::cin>>n;
n--;
std::vector<int>a(n),b(n);
for(int i=0;i<n;i++){
std::cin>>a.at(i)>>b.at(i);
}
int A=std::accumulate(a.begin(),a.end(),0);
int B=std::accumulate(b.begin(),b.end(),0);
int ans=std::min(A,B);
for(int i=0;i<n;i++){
int z=A-a.at(i)+B-b.at(i);
if(z<ans)ans=z;
}
std::cout<<ans+1<<'\n';
}
ngtkana