結果
| 問題 |
No.716 距離
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-09-20 21:44:13 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 450 bytes |
| コンパイル時間 | 612 ms |
| コンパイル使用メモリ | 72,664 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-18 08:36:46 |
| 合計ジャッジ時間 | 1,540 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 WA * 16 |
ソースコード
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
int n;
vector<int> a;
bool flag=false;
cin >> n;
for (int i = 0;i < n;i++) {
int buf;
cin >> buf;
a.push_back(buf);
}
for (int i = 0;i < a.size()-1;i++) {
if (a[i] == a[i + 1])flag = true;
}
if (flag)cout << 0 << endl;
else cout << abs(a[1] - a[0]) << endl;
cout << abs(a[a.size() - 1] - a[0]) << endl;
return 0;
}