結果
| 問題 |
No.904 サメトロ
|
| コンテスト | |
| ユーザー |
ngtkana
|
| 提出日時 | 2020-03-09 14:16:32 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 584 bytes |
| コンパイル時間 | 1,698 ms |
| コンパイル使用メモリ | 168,588 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-07 23:03:35 |
| 合計ジャッジ時間 | 2,954 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 WA * 13 |
ソースコード
#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<<B-b.at(i)+1<<'\n';
return 0;
}
}
std::cout<<A+1<<'\n';
}
ngtkana