結果

問題 No.1120 Strange Teacher
ユーザー kaede2020kaede2020
提出日時 2020-07-22 22:07:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 487 bytes
コンパイル時間 1,539 ms
コンパイル使用メモリ 166,272 KB
実行使用メモリ 4,736 KB
最終ジャッジ日時 2023-09-04 20:42:50
合計ジャッジ時間 4,145 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 7 ms
4,376 KB
testcase_04 AC 56 ms
4,624 KB
testcase_05 AC 59 ms
4,552 KB
testcase_06 AC 57 ms
4,716 KB
testcase_07 AC 56 ms
4,552 KB
testcase_08 AC 56 ms
4,732 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 58 ms
4,644 KB
testcase_11 AC 58 ms
4,720 KB
testcase_12 AC 59 ms
4,588 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 2 ms
4,384 KB
testcase_19 AC 64 ms
4,640 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 WA -
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 51 ms
4,604 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 WA -
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin>>n;
  long long wa_a=0;
  long long wa_b=0;
  long long sa=0;
  vector<long long >a(n),b(n);
  long long kotae=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
    wa_a+=a[i];
  }
  for(int i=0;i<n;i++){
    cin>>b[i];
    wa_b+=b[i];
  }
  for(int i=0;i<n;i++){
    sa=max(sa,b[i]-a[i]);
  }
  if(sa*(n-2)<= wa_a-wa_b){
    kotae=(wa_a-wa_b)/(n-2);
    cout<<kotae<<endl;
  }else{
    cout<<-1<<endl;
  }
  return 0;
}
0