結果

問題 No.904 サメトロ
ユーザー 👑 CleyLCleyL
提出日時 2019-10-11 21:38:58
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 393 bytes
コンパイル時間 582 ms
コンパイル使用メモリ 68,928 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-25 06:59:25
合計ジャッジ時間 1,374 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>
using namespace std;
typedef pair<int,int> Paint;
int main(){
  int n;cin>>n;
  if(n==2){
    cout << 1 << endl;
    return 0;
  }
  Paint a[n];
  int sa = 0;
  int sma = 0;
  int smb = 0;
  for(int i = 0; n-1 > i; i++){
    int te,mp;cin>>te>>mp;
    sa += te-mp;
    sma += te;
    smb+=mp;
    a[i] = {te,mp};
  }
  cout << min(sma,smb)+1 << endl;
  

}
0