結果
| 問題 |
No.966 引き算をして門松列(その1)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-01-13 20:50:04 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,293 bytes |
| コンパイル時間 | 1,755 ms |
| コンパイル使用メモリ | 168,452 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-21 16:52:40 |
| 合計ジャッジ時間 | 2,329 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | WA * 5 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int t;
cin >> t;
for (int lo = 0; lo < t; ++lo) {
vector<ll> a(3);
for (int i = 0; i < 3; ++i) {
cin >> a[i];
}
if (a[0] == a[1] && a[1] == a[2]) {
if (a[1] <= 2) {
cout << -1 << "\n";
} else {
cout << 3 << "\n";
}
continue;
}
if (a[2] < a[0]) swap(a[0], a[2]);
ll cnt = 0;
if (a[0] == a[2]) {
a[0]--;
cnt++;
}
if (a[0] == 0) {
cout << -1 << "\n";
continue;
}
if (a[1] == a[0]) {
if (a[1] <= 1) cout << -1 << "\n";
else cout << cnt + 1 << "\n";
continue;
}
if (a[2] == a[1]) {
if (a[2] <= 1) cout << -1 << "\n";
else cout << cnt + 1 << "\n";
continue;
}
if (a[2] < a[1] || a[0] > a[1]) {
cout << cnt << "\n";
} else if (a[0] == 1) {
cout << -1 << "\n";
} else {
cout << cnt + a[1] - min(a[0], a[2]) + 1 << "\n";
}
}
return 0;
}