Submission #1659413
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; vector<bool>F(N,true); for( size_t i = 0; i < N; i++ ){ if(F[i] ){ ans++; long long int minv = i+1, maxv = N; while( minv+1<maxv ){ long long int midv = ( minv + maxv ) / 2; //cout << minv << " " << midv << " " << maxv << endl; if( D[i]+D[midv]+1<=C ){ maxv = midv; } else{ minv = midv; } } minv++; //cout << minv << endl; while( minv < N&&!F[minv] )minv++; if(minv<N)F[minv]= false; //cout << minv << endl; } } cout << ans << endl; }
Submission Info
Submission Time | |
---|---|
Task | C - 収納 |
User | goryudyuma |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 779 Byte |
Status | WA |
Exec Time | 416 ms |
Memory | 1024 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | 57 ms | 1024 KB |
02.txt | AC | 56 ms | 1024 KB |
03.txt | AC | 416 ms | 1024 KB |
04.txt | AC | 51 ms | 1024 KB |
05.txt | WA | 160 ms | 1024 KB |
06.txt | AC | 22 ms | 1024 KB |
07.txt | AC | 28 ms | 1024 KB |
08.txt | WA | 38 ms | 1024 KB |
09.txt | WA | 41 ms | 1024 KB |
10.txt | AC | 22 ms | 1024 KB |
11.txt | AC | 57 ms | 1024 KB |
12.txt | AC | 49 ms | 1024 KB |
13.txt | WA | 33 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 |