zoj
/*
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdio>
using namespace std;
typedef long long ll;
#define N 100005
int num1[N];
int num2[N];
int num3[N];
int num4[N];
int num5[N];
int main() {
int t;
int n;
cin >> t;
while (t--)
{
scanf("%d", &n);
for (int i = 0; i <n ; i++)
{
scanf("%d", &num1[i]);
num3[num1[i]] = i;
}
for (int i = 0; i <n; i++)
{
scanf("%d", &num2[i]);
num4[num2[i]] = i;
}
int a, b;
int co = 0;
for (int i = 1; i <= n; i++)
{
a = num3[i];
b = num4[i];
if (a ==b)
{
if (a == 0)
{
num5[co++] = 0;
}
else
{
if (num1[a - 1] != num2[b-1])
num5[co++] =num1[a-4];
else
{
num5[co++] = num1[a - 1];
}
}
}
else
{
if (a > b)
{
num5[co++] = num1[b - 1];
}
else
{
num5[co++] = num1[a- 1];
}
}
}
for (int i = 0; i < n; i++)
{
if (i == n - 1)
{
printf("%d", num5[i]);
}
else
{
printf("%d ", num5[i]);
}
}
cout<< endl;
}
return 0;
}
*/
相關文章
- Diablo III ZOJ - 3769
- ZOJ 3732 Graph ReconstructionStruct
- ZOJ - 2112 Dynamic Rankings
- ZOJ Monthly, March 2018
- ZOJ4043 : Virtual Singers
- ZOJ 3956——Course Selection System(01揹包)
- ZOJ2019年1月月賽
- 【訓練題19:概率DP】One Person Game | ZOJ3329GAM
- ZOJ Monthly, January 2019 - A Little Sub and Pascal's Triangle(找規律)
- ZOJ Martian Addition (20進位制的兩個大數相加)
- ZOJ——Copying Books 最大值最小化問題 (貪心 + 二分)
- zoj-4053(2018ICPC青島網路賽K題)啟發式分裂