Submission #73897148


Source Code Expand

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=3e5+114;
struct QWQ
{
	int id,v;
}a[N];
string s;
int b[N],c[N],tot[N],n,m,k,ans,kth[N];
bool cmp(QWQ a,QWQ b)
{
	return a.v<b.v;
}
signed main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i].v,a[i].id=i;
	}
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=n;i++)
	{
		kth[a[i].id]=i;
	}
	for(int i=1;i<=m;i++)
	{
		cin>>k;
		for(int i=1;i<=k;i++) cin>>c[i],c[i]=kth[c[i]];
		sort(c+1,c+k+1);
        int flag=0;
		for(int i=1;i<=k;i++)
		{
			if(c[i]!=c[i-1]+1)
			{
				cout<<a[i].v<<'\n';
                flag=1;
				break;
			}
		}
        if(!flag) cout<<a[k+1].v<<'\n';
	}
	return 0;
}

Submission Info

Submission Time
Task C - Except and Min
User zhangjizhiava
Language C++23 (GCC 15.2.0)
Score 300
Code Size 709 Byte
Status AC
Exec Time 228 ms
Memory 10656 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 1
AC × 19
Set Name Test Cases
Sample 00_sample_00.txt
All 00_sample_00.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 02_random_2_00.txt, 02_random_2_01.txt, 02_random_2_02.txt, 02_random_2_03.txt, 02_random_2_04.txt, 02_random_2_05.txt, 03_random_3_00.txt, 03_random_3_01.txt, 03_random_3_02.txt, 03_random_3_03.txt, 03_random_3_04.txt, 03_random_3_05.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3520 KiB
01_random_00.txt AC 227 ms 10488 KiB
01_random_01.txt AC 169 ms 10484 KiB
01_random_02.txt AC 219 ms 10448 KiB
01_random_03.txt AC 224 ms 10576 KiB
01_random_04.txt AC 199 ms 10576 KiB
01_random_05.txt AC 197 ms 10656 KiB
02_random_2_00.txt AC 228 ms 10576 KiB
02_random_2_01.txt AC 215 ms 10600 KiB
02_random_2_02.txt AC 185 ms 10576 KiB
02_random_2_03.txt AC 227 ms 10488 KiB
02_random_2_04.txt AC 181 ms 10640 KiB
02_random_2_05.txt AC 174 ms 10604 KiB
03_random_3_00.txt AC 220 ms 10604 KiB
03_random_3_01.txt AC 224 ms 10484 KiB
03_random_3_02.txt AC 227 ms 10600 KiB
03_random_3_03.txt AC 216 ms 10488 KiB
03_random_3_04.txt AC 227 ms 10448 KiB
03_random_3_05.txt AC 222 ms 10656 KiB