結果
問題 | No.1120 Strange Teacher |
ユーザー |
![]() |
提出日時 | 2020-07-23 00:15:01 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 552 bytes |
コンパイル時間 | 1,546 ms |
コンパイル使用メモリ | 168,708 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-23 02:43:58 |
合計ジャッジ時間 | 4,056 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 WA * 2 RE * 3 |
ソースコード
#include<bits/stdc++.h>using namespace std;using ll = long long;int main(){int n;cin >> n;vector<int> a(n), b(n);for(int i = 0; i < n; i++)cin >> a[i];for(int i = 0; i < n; i++)cin >> b[i];ll sum = 0, k = 0;for(int i = 0; i < n; i++) sum += (a[i] - b[i]);if(sum % (n - 2)) {cout << -1 << endl; return 0;}k = sum / (n - 2);for(int i = 0; i < n; i++) {if((b[i] - a[i] + k) & 1) {cout << -1 << endl;return 0;}}cout << k << endl;}