提出 #50572824
ソースコード 拡げる
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0), cout.tie(0); int n; cin >> n; vector<int> p(n), ip(n); for (int i = 0; i < n; ++i) { cin >> p[i]; ip[--p[i]] = i; } int q; cin >> q; while (q--) { int l, r; cin >> l >> r; --l, --r; cout << (ip[l] < ip[r] ? l : r) + 1 << '\n'; } return 0; }
提出情報
提出日時 | |
---|---|
問題 | B - Which is ahead? |
ユーザ | achvanov |
言語 | C++ 20 (gcc 12.2) |
得点 | 200 |
コード長 | 415 Byte |
結果 | AC |
実行時間 | 1 ms |
メモリ | 3632 KiB |
ジャッジ結果
セット名 | Sample | All | ||||
---|---|---|---|---|---|---|
得点 / 配点 | 0 / 0 | 200 / 200 | ||||
結果 |
|
|
セット名 | テストケース |
---|---|
Sample | 00_sample_01.txt, 00_sample_02.txt |
All | 00_sample_01.txt, 00_sample_02.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt |
ケース名 | 結果 | 実行時間 | メモリ |
---|---|---|---|
00_sample_01.txt | AC | 1 ms | 3484 KiB |
00_sample_02.txt | AC | 1 ms | 3624 KiB |
01_test_01.txt | AC | 1 ms | 3492 KiB |
01_test_02.txt | AC | 1 ms | 3628 KiB |
01_test_03.txt | AC | 1 ms | 3632 KiB |
01_test_04.txt | AC | 1 ms | 3500 KiB |
01_test_05.txt | AC | 1 ms | 3436 KiB |
01_test_06.txt | AC | 1 ms | 3476 KiB |
01_test_07.txt | AC | 1 ms | 3496 KiB |
01_test_08.txt | AC | 1 ms | 3484 KiB |
01_test_09.txt | AC | 1 ms | 3416 KiB |
01_test_10.txt | AC | 1 ms | 3440 KiB |
01_test_11.txt | AC | 1 ms | 3564 KiB |
01_test_12.txt | AC | 1 ms | 3364 KiB |