結果
| 問題 |
No.1120 Strange Teacher
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-22 22:27:08 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 664 bytes |
| コンパイル時間 | 1,544 ms |
| コンパイル使用メモリ | 169,796 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-22 19:06:17 |
| 合計ジャッジ時間 | 3,615 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 23 WA * 4 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin>>N;
long long H=0;
long long K=0;
vector<int>A(N);
vector<int>B(N);
for(int X=0;X<N;X++){
cin>>A[X];
H+=A[X];
}
bool U=true;
for(int X=0;X<N;X++){
cin>>B[X];
K+=B[X];
if(A[X]!=B[X]){
U=false;
}
}
if(N!=2&&(H-K)%(N-2)==0){
cout<<(H-K)/(N-2)<<endl;
}
else if(N==2&&abs(A.at(0)-B.at(0))==abs(A.at(1)-B.at(1))&&A[0]-B[0]!=A[1]-B[1]){
cout<<abs(A.at(0)-B.at(0))<<endl;
}
else if(U==true){
cout<<0<<endl;
}
else{
cout<<-1<<endl;
}
}