Submission #1657402


Source Code Expand

#include <bits/stdc++.h>
/*
*/

using namespace std;



int main(){
	long long int N,C;
	cin >> N >> C;
	vector<long long int>D(N);
	for( size_t i = 0; i < N; i++ ){
		cin >> D[i];
	}
	sort(D.rbegin(), D.rend());
	long long int ans = 0;
	for( size_t i = 0; i < N; i++ ){
		if( D[i]!=-1 ){
			ans++;
			for( size_t j = i+1; j < N; j++ ){
				if(D[j]!=-1 )
				if( D[i] + D[j] + 1 <= C ){
					D[j] = -1;
					break;
				}
			}
		}
	}
	cout << ans << endl;
}

Submission Info

Submission Time
Task C - 収納
User goryudyuma
Language C++14 (GCC 5.4.1)
Score 0
Code Size 490 Byte
Status TLE
Exec Time 2103 ms
Memory 1024 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 5
TLE × 11
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
01.txt TLE 2103 ms 1024 KB
02.txt TLE 2103 ms 1024 KB
03.txt TLE 2103 ms 1024 KB
04.txt TLE 2103 ms 1024 KB
05.txt AC 1808 ms 1024 KB
06.txt TLE 2103 ms 1024 KB
07.txt AC 27 ms 1024 KB
08.txt TLE 2103 ms 1024 KB
09.txt TLE 2103 ms 1024 KB
10.txt TLE 2103 ms 1024 KB
11.txt TLE 2103 ms 1024 KB
12.txt TLE 2103 ms 1024 KB
13.txt TLE 2103 ms 1024 KB
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
sample_03.txt AC 1 ms 256 KB