Submission #2825724
Source Code Expand
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部0にする
vector<ll> G[100005];
vector<P> tree[100010];
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,a,b) for(i=a;i<=b;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
ll rui(ll abc,ll bed){
//aのb乗を計算する
if(bed==0){return 1;}
else{
ll ced = rui(abc,bed/2);
ced *= ced;
ced %= mod;
if(bed%2==1){ced*=abc; ced%=mod;}
return ced;
}
}
ll i,j,k,ii,jj;
ll n,m,sum,num;
ll a,b,c,d,e,ans;
ll x[500005],y[500005];
bool used[500005];
string s,t;
int main(){
cin>>n>>c;
for(i=0;i<n;i++){
cin>>x[i];
}
sort(x,x+n);
for(i=n-1;i>=0;i--){
if(used[i])break;
if(x[i]+x[num]+1<=c){
used[num]=true;
num++;
ans++;
}else{
ans++;
}
}
p(ans);
return 0;
}
Submission Info
Submission Time |
|
Task |
C - 収納 |
User |
enjapma |
Language |
C++14 (GCC 5.4.1) |
Score |
300 |
Code Size |
1473 Byte |
Status |
AC |
Exec Time |
48 ms |
Memory |
7168 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
300 / 300 |
Status |
|
|
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 |
AC |
48 ms |
7168 KB |
02.txt |
AC |
48 ms |
7168 KB |
03.txt |
AC |
32 ms |
7168 KB |
04.txt |
AC |
45 ms |
7168 KB |
05.txt |
AC |
26 ms |
7168 KB |
06.txt |
AC |
20 ms |
7040 KB |
07.txt |
AC |
28 ms |
7168 KB |
08.txt |
AC |
36 ms |
7168 KB |
09.txt |
AC |
40 ms |
7168 KB |
10.txt |
AC |
19 ms |
7040 KB |
11.txt |
AC |
48 ms |
7168 KB |
12.txt |
AC |
47 ms |
7168 KB |
13.txt |
AC |
30 ms |
7168 KB |
sample_01.txt |
AC |
3 ms |
7040 KB |
sample_02.txt |
AC |
3 ms |
7040 KB |
sample_03.txt |
AC |
3 ms |
7040 KB |