結果
| 問題 | No.904 サメトロ |
| コンテスト | |
| ユーザー |
ngtkana
|
| 提出日時 | 2020-03-09 14:19:31 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 594 bytes |
| 記録 | |
| コンパイル時間 | 1,187 ms |
| コンパイル使用メモリ | 182,752 KB |
| 実行使用メモリ | 7,976 KB |
| 最終ジャッジ日時 | 2026-05-08 06:30:01 |
| 合計ジャッジ時間 | 2,414 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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);
}
if(std::accumulate(a.begin(),a.end(),0)
>std::accumulate(b.begin(),b.end(),0)){
std::swap(a,b);
}
int A=std::accumulate(a.begin(),a.end(),0);
int B=std::accumulate(b.begin(),b.end(),0);
for(int i=0;i<n;i++){
if(a.at(i)+b.at(i)>B){
std::cout<<A-a.at(i)+B-b.at(i)+1<<'\n';
return 0;
}
}
std::cout<<A+1<<'\n';
}
ngtkana