Submission #73496701


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
int main(){
	int A,B,T;
	cin>>T;
	vector<int>arr(T);
	for(int i=0;i<T;i++)
	cin>>arr[i];
	unordered_map<int,int>mymap;
	for(int i=0;i<T;i++){
		if(mymap.find(arr[i])==mymap.end()){
			if(mymap.find(arr[i]-1)==mymap.end()){
			mymap[arr[i]]=1;
		}
		else{
			mymap[arr[i]]=mymap[arr[i]-1]+1;
		}
		}
		else{
			mymap[arr[i]]=max(mymap[arr[i]],mymap[arr[i]-1]+1);
		}
	}
	int SP=-1;
	for(auto it=mymap.begin();it!=mymap.end();++it)
	{
		SP=max(SP,it->second);
	}
	cout<<SP;
}

Submission Info

Submission Time
Task D - Max Straight
User huhehaotedong
Language C++23 (GCC 15.2.0)
Score 400
Code Size 546 Byte
Status AC
Exec Time 79 ms
Memory 13648 KiB

Compile Error

./Main.cpp: In function 'int main()':
./Main.cpp:4:13: warning: unused variable 'A' [-Wunused-variable]
    4 |         int A,B,T;
      |             ^
./Main.cpp:4:15: warning: unused variable 'B' [-Wunused-variable]
    4 |         int A,B,T;
      |               ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 26
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.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, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3452 KiB
00_sample_01.txt AC 1 ms 3612 KiB
00_sample_02.txt AC 1 ms 3412 KiB
01_random_00.txt AC 1 ms 3500 KiB
01_random_01.txt AC 1 ms 3360 KiB
01_random_02.txt AC 1 ms 3620 KiB
01_random_03.txt AC 43 ms 13544 KiB
01_random_04.txt AC 56 ms 13552 KiB
01_random_05.txt AC 43 ms 8748 KiB
01_random_06.txt AC 20 ms 6112 KiB
01_random_07.txt AC 79 ms 13476 KiB
01_random_08.txt AC 18 ms 3700 KiB
01_random_09.txt AC 1 ms 3624 KiB
01_random_10.txt AC 45 ms 4204 KiB
01_random_11.txt AC 49 ms 4224 KiB
01_random_12.txt AC 5 ms 3736 KiB
01_random_13.txt AC 49 ms 4204 KiB
01_random_14.txt AC 2 ms 3580 KiB
01_random_15.txt AC 51 ms 4488 KiB
01_random_16.txt AC 26 ms 3900 KiB
01_random_17.txt AC 60 ms 13468 KiB
01_random_18.txt AC 60 ms 13528 KiB
01_random_19.txt AC 66 ms 13620 KiB
01_random_20.txt AC 44 ms 9628 KiB
01_random_21.txt AC 72 ms 13648 KiB
01_random_22.txt AC 6 ms 4392 KiB