Contest Duration: ~ (local time) (140 minutes) Back to Home

Submission #3199101

Source Code Expand

Copy
```#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

const int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
const int dy[8] = { 0,1,1,1,0,-1,-1,-1 };

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll n, x;
cin >> n >> x;
vl v(n);
REP(i, n)cin >> v[i];
sort(ALL(v));
REP(i, n-1) {
if (x < v[i]) {
cout << i << endl;
return 0;
}
x -= v[i];
}
if (x == v.back()) {
cout << n << endl;
}
else {
cout << n - 1 << endl;
}
}```

#### Submission Info

Submission Time 2018-09-15 21:04:10+0900 A - Candy Distribution Again etonagisa C++14 (Clang 3.8.0) 0 988 Byte CE

#### Compile Error

```./Main.cpp:1:10: fatal error: 'bits/stdc++.h' file not found
#include "bits/stdc++.h"
^
1 error generated.
```