Submission #3425272
Source Code Expand
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, a) for (int i = 0; (i) < (int) (a); (i)++) #define reps(i, a, b) for (int i = (int) (a); (i) < (int) (b); (i)++) #define rrep(i, a) for (int i = (int) a-1; (i) >= 0; (i)--) #define rreps(i, a, b) for (int i = (int) (a)-1; (i) >= (int) (b); (i)--) #define MP(a, b) make_pair((a), (b)) #define PB(a) push_back((a)) #define all(v) (v).begin(), (v).end() #define PERM(v) next_permutation(all(v)) #define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end()) #define CIN(type, x) type x;cin >> x #define TRUE__ "Yes" #define FALSE__ "No" #define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;} #define RS(N) resize(N) #define CINV(v, N) do {\ v.RS(N);\ rep(i, N) cin >> v[i];\ } while (0); #define RCINV(v, N) do {\ v.RS(N);\ rrep(i, N) cin >> v[i];\ } while (0); #define MOD 1000000007 void init(); void solve(); signed main() { init(); solve(); } int N; int C; vector<int> l; void init() { cin >> N >> C; CINV(l, N); sort(all(l)); } void solve() { int big = N-1; int small = 0; for (; big >= 0 && l[big] + l[0] + 1 > C; big--); if (big <= 0) { cout << N << endl; return; } int res = N; while (big > small) { for (; big > small && l[big] + l[small] + 1 > C; big--); if (big == small) break; res--; small++; big--; } cout << res << endl; }
Submission Info
Submission Time | |
---|---|
Task | C - 収納 |
User | spihill |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 1456 Byte |
Status | AC |
Exec Time | 60 ms |
Memory | 640 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 | 60 ms | 640 KB |
02.txt | AC | 60 ms | 640 KB |
03.txt | AC | 36 ms | 640 KB |
04.txt | AC | 57 ms | 640 KB |
05.txt | AC | 29 ms | 640 KB |
06.txt | AC | 20 ms | 640 KB |
07.txt | AC | 32 ms | 640 KB |
08.txt | AC | 43 ms | 640 KB |
09.txt | AC | 47 ms | 640 KB |
10.txt | AC | 20 ms | 640 KB |
11.txt | AC | 60 ms | 640 KB |
12.txt | AC | 59 ms | 640 KB |
13.txt | AC | 33 ms | 640 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 |