提出 #50584337
ソースコード 拡げる
// Author: XZC(L_Wave)
// Language: Cpp/G++14
// Problem: B - Which is ahead?
// Contest: AtCoder - HUAWEI Programming Contest 2024(AtCoder Beginner Contest 342)
// URL: https://atcoder.jp/contests/abc342/tasks/abc342_b
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Create Time: not 2024-02-24 20:00:13, but 1926-08-17 11:45:14
//
// Powered by CP Editor (https://cpeditor.org)
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a), i##ABRACADABRA = (b); i <= i##ABRACADABRA; i++)
#define drep(i, a, b) for (int i = (a), i##ABRACADABRA = (b); i >= i##ABRACADABRA; i--)
using namespace std;
using ll = long long;
int n,p[111],q[111];
int main() {
cin>>n;
rep(i,1,n)cin>>p[i],q[p[i]]=i;
int qq;
cin>>qq;
while (qq--){
int x,y;
cin>>x>>y;
if (q[x]<q[y])cout<<x<<'\n';
else cout<<y<<'\n';
}
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | B - Which is ahead? |
| ユーザ | fft_ntt |
| 言語 | C++ 20 (gcc 12.2) |
| 得点 | 200 |
| コード長 | 881 Byte |
| 結果 | AC |
| 実行時間 | 1 ms |
| メモリ | 3644 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 | 3444 KiB |
| 00_sample_02.txt | AC | 1 ms | 3556 KiB |
| 01_test_01.txt | AC | 1 ms | 3452 KiB |
| 01_test_02.txt | AC | 1 ms | 3428 KiB |
| 01_test_03.txt | AC | 1 ms | 3468 KiB |
| 01_test_04.txt | AC | 1 ms | 3460 KiB |
| 01_test_05.txt | AC | 1 ms | 3456 KiB |
| 01_test_06.txt | AC | 1 ms | 3556 KiB |
| 01_test_07.txt | AC | 1 ms | 3568 KiB |
| 01_test_08.txt | AC | 1 ms | 3456 KiB |
| 01_test_09.txt | AC | 1 ms | 3568 KiB |
| 01_test_10.txt | AC | 1 ms | 3640 KiB |
| 01_test_11.txt | AC | 1 ms | 3644 KiB |
| 01_test_12.txt | AC | 1 ms | 3492 KiB |