提出 #36049526
ソースコード 拡げる
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> h(n);
for (int i = 0; i < n; i++) {
cin >> h.at(i);
}
priority_queue<int> p;
for (int i = 0; i < n; i++) {
p.push(h.at(i));
}
int a = p.top();
int ans;
for (int i = 0; i < n; i++) {
if (h.at(i) == a) {
ans = i + 1;
break;
}
}
cout << ans << endl;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | A - Find Takahashi |
| ユーザ | Awes |
| 言語 | C++ (GCC 9.2.1) |
| 得点 | 100 |
| コード長 | 478 Byte |
| 結果 | AC |
| 実行時間 | 5 ms |
| メモリ | 3600 KiB |
コンパイルエラー
./Main.cpp: In function ‘int main()’:
./Main.cpp:28:13: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized]
28 | cout << ans << endl;
| ^~~
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 100 / 100 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | example_00.txt, example_01.txt, example_02.txt |
| All | example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| example_00.txt | AC | 5 ms | 3492 KiB |
| example_01.txt | AC | 2 ms | 3416 KiB |
| example_02.txt | AC | 2 ms | 3416 KiB |
| hand_00.txt | AC | 2 ms | 3416 KiB |
| hand_01.txt | AC | 2 ms | 3496 KiB |
| hand_02.txt | AC | 2 ms | 3592 KiB |
| random_00.txt | AC | 4 ms | 3468 KiB |
| random_01.txt | AC | 2 ms | 3552 KiB |
| random_02.txt | AC | 3 ms | 3424 KiB |
| random_03.txt | AC | 2 ms | 3496 KiB |
| random_04.txt | AC | 4 ms | 3600 KiB |
| random_05.txt | AC | 2 ms | 3520 KiB |