Submission #3578580
Source Code Expand
#include <bits/stdc++.h> const int INF = 1e9; const int MOD = 1e9+7; using LL = long long; const LL LINF = 1e18; const double EPS = 1e-10; using namespace std; #define COUT(v) cout<<(v)<<endl #define COUTDOUBLE(v) cout << std::setprecision(10)<<(v)<<endl; #define CIN(n) int(n);cin >> (n) #define LCIN(n) LL(n);cin >> (n) #define SCIN(n) string(n);cin >> (n) #define YES(n) cout<<((n)? "YES" : "NO")<<endl #define Yes(n) cout<<((n)? "Yes" : "No")<<endl #define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE" ) << endl #define Possible(n) cout << ((n) ? "Possible" : "Impossible" ) <<endl #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) for(int i=0;i<(n);++i) #define REPR(i,n) for(int i=n;i>=0;i--) #define FOREACH(x,a) for(auto& (x) : (a) ) #define ALL(obj) (obj).begin(),(obj).end() #define P pair<LL,LL> #define I vector<int> #define pb(v) push_back(v) #define V vector #define rt return #define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end()) #define ENDL cout<<endl #define f first #define s second typedef string::const_iterator State; class PalseError {}; class Edge{ public: int from,to,value; Edge(LL a,LL b,LL c){ from = a; to = b; value = c; } Edge(LL a,LL b){ from = a; to = b; } }; int main(){ CIN(N); I vec; CIN(K); REP(a,N){ CIN(b); vec.push_back(b); } sort(ALL(vec),greater<int>()); int tani = 0; REP(a,N){ tani += vec.at(a); if(K <= tani){ COUT(a+1); return 0; } } COUT(-1); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Credits |
User | hamuhei4869 |
Language | C++14 (GCC 5.4.1) |
Score | 100 |
Code Size | 1685 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 256 KB |
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 100 / 100 | ||
Status |
|
Set Name | Test Cases |
---|---|
All | corner_10, corner_11, corner_12, corner_13, max_14, random_00, random_01, random_02, random_03, random_04, random_05, random_06, random_07, random_08, random_09, sample_00, sample_01, sample_02 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
corner_10 | AC | 1 ms | 256 KB |
corner_11 | AC | 1 ms | 256 KB |
corner_12 | AC | 1 ms | 256 KB |
corner_13 | AC | 1 ms | 256 KB |
max_14 | AC | 1 ms | 256 KB |
random_00 | AC | 1 ms | 256 KB |
random_01 | AC | 1 ms | 256 KB |
random_02 | AC | 1 ms | 256 KB |
random_03 | AC | 1 ms | 256 KB |
random_04 | AC | 1 ms | 256 KB |
random_05 | AC | 1 ms | 256 KB |
random_06 | AC | 1 ms | 256 KB |
random_07 | AC | 1 ms | 256 KB |
random_08 | AC | 1 ms | 256 KB |
random_09 | AC | 1 ms | 256 KB |
sample_00 | AC | 1 ms | 256 KB |
sample_01 | AC | 1 ms | 256 KB |
sample_02 | AC | 1 ms | 256 KB |