結果
| 問題 |
No.1120 Strange Teacher
|
| コンテスト | |
| ユーザー |
otamay6
|
| 提出日時 | 2020-07-22 21:32:15 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 739 bytes |
| コンパイル時間 | 1,448 ms |
| コンパイル使用メモリ | 168,912 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-22 13:56:27 |
| 合計ジャッジ時間 | 3,158 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 WA * 4 |
ソースコード
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;
int main(){
int N;cin>>N;
ll sumA=0,sumB =0;
ll ad=0;
vector<ll> A(N);
REP(i,N){
cin>>A[i];
sumA+=A[i];
}
REP(i,N){
ll b;cin>>b;
if(b>A[i]){
ad = max(ad,b-A[i]);
}
sumB+=b;
}
if(N==2){
if(sumA==sumB) cout<<ad<<endl;
else cout<<-1<<endl;
return 0;
}
if((sumA-sumB)%(N-2)==0&&ad <= (sumA-sumB)/(N-2)) cout<<(sumA-sumB)/(N-2)<<endl;
else cout<<-1<<endl;
}
otamay6