#include <iostream>
using namespace std;
int main() //二位指针数组
{
int T; //1<=T<=13
cin >> T;
// int n, m; //n为验题人数量,m为AC队伍数 (2≤n≤20,0≤m≤500)
int**N = new int*[T]; //二维数组n储存T道题的T*n个代码长度
for (int i = 0; i < T; ++i)
{
N[i] = new int[20];
}
int**M = new int*[T]; //二维数组n储存T道题的T*n个代码长度
for (int i = 0; i < T; ++i)
{
M[i] = new int[500];
}
int**NM = new int*[T]; //二维数组n储存T道题的n,m
for (int i = 0; i < T; ++i)
{
NM[i] = new int[2];
}
int**Min = new int*[T]; //二维数组n储存T道题的n,m
for (int i = 0; i < T; ++i)
{
Min[i] = new int[2];
}
for (int t = 0; t < T; ++t) //赋值
{
cin >> NM[t][0]>> NM[t][1];
int i = 0;
int a;
cin >> a;
while (i < NM[t][0])
{
N[t][i] = a;
++i;
if(i!=NM[t][0] ) cin >> a;
}
i = 0;
while (i < NM[t][1])
{
cin >> a;
M[t][i] = a;
++i;
}
}
for (int i = 0; i < T; ++i)
{
Min[i][0] = N[i][0];
for (int j = 1; j < NM[i][0]; ++j)
{
if (N[i][j] < Min[i][0]) Min[i][0] = N[i][j];
}
Min[i][1] = M[i][0];
for (int k = 1; k < NM[i][1]; ++k)
{
if (M[i][k] < Min[i][1]) Min[i][1] = M[i][k];
}
}
for (int t = 0; t < T; ++t) //显示输出
{
cout << "Problem " << t + 1001<<":"<<endl;
cout << "Shortest judge solution: " << Min[t][0] << " bytes."<<endl;
if(NM[t][1] == 0) cout << "Shortest team solution: " << "N/A"<< " bytes." << endl;
else cout << "Shortest team solution: " << Min[t][1] << " bytes." << endl;
}
}
第二周test1 一周赛G HDU - 6292
最新推荐文章于 2021-09-18 20:10:34 发布