Submission #3776022
Source Code Expand
#include<stdio.h> #include<iostream> #include<vector> #include<algorithm> #include<string> #include<string.h> #include<math.h> #include<utility> #include<map> using namespace std; typedef long long int ll; typedef long double ld; typedef vector<ll> vi; typedef vector<string> vs; typedef pair<ll,ll> P; typedef vector<P> vp; #define REP(i,n) for(int i=0;i<n;i++) #define FOR(i,m,n) for(int i=m;i<n;i++) #define REPR(i,n) for(int i=n-1;i>=0;i--) #define FORR(i,n,m) for(int i=n-1;i>=m;i--) #define all(in) in.begin(),in.end() #define ALL(in,K) in,in+K #define INF 1e18 #define MOD 100000007 #define SIZE 100005 #define PI 3.14159265358979323846 int main(){ cin.tie(0); ios::sync_with_stdio(false); ll n,x; cin >> n >> x; ll a[10]; REP(i,n)cin >> a[i]; sort(a,a+n); int i; for(i=0;i<n;i++){ x -= a[i]; if(x<0)break; } //cout << i << endl; //if(i==n)i--; if(x>0)i--; cout << i << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Candy Distribution Again |
User | hide0903 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1017 Byte |
Status | RE |
Exec Time | 109 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 200 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt |
All | 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_00.txt | AC | 1 ms | 256 KB |
0_01.txt | AC | 1 ms | 256 KB |
0_02.txt | AC | 1 ms | 256 KB |
0_03.txt | AC | 1 ms | 256 KB |
1_00.txt | RE | 103 ms | 256 KB |
1_01.txt | RE | 103 ms | 256 KB |
1_02.txt | RE | 103 ms | 256 KB |
1_03.txt | RE | 103 ms | 256 KB |
1_04.txt | RE | 104 ms | 256 KB |
1_05.txt | RE | 104 ms | 256 KB |
1_06.txt | RE | 109 ms | 256 KB |
1_07.txt | RE | 102 ms | 256 KB |