結果
問題 | No.1687 What the Heck? |
ユーザー |
|
提出日時 | 2021-09-24 22:35:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 370 bytes |
コンパイル時間 | 473 ms |
コンパイル使用メモリ | 69,504 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-05 10:59:57 |
合計ジャッジ時間 | 1,667 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 2 WA * 16 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:23:35: warning: 'I' may be used uninitialized [-Wmaybe-uninitialized] 23 | LL X = N * (N + 1) / 2 - 2*I; | ~^~ main.cpp:16:13: note: 'I' was declared here 16 | int I; | ^
ソースコード
#include <iostream> #include <vector> typedef long long LL; using namespace std; int main() { int N, i; cin >> N; if (N == 1) { cout << 0 << endl; return 0; } vector<int> P(N+1); int take = 0; int suzuki = 0; int I; for (i = 1; i <= N; i++) { cin >> P[i]; if (P[i] == N) { I = i; } } LL X = N * (N + 1) / 2 - 2*I; cout << X << endl; return 0; }