結果
| 問題 | No.1687 What the Heck? |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-08-27 09:43:23 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 361 bytes |
| 記録 | |
| コンパイル時間 | 1,930 ms |
| コンパイル使用メモリ | 193,028 KB |
| 最終ジャッジ日時 | 2025-01-31 06:10:23 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 8 WA * 10 |
ソースコード
typedef long long ll;
typedef long double ld;
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
ll n;
std::cin >> n;
ll ans = n*(n+1)/2;
for (int i = 0; i < n; i++) {
ll p;
std::cin >> p;
if(p==n){
ans -= 2*(i+1);
}
}
std::cout << max(0ll,ans) << std::endl;
}