# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
3571 | hyeonjae0310 | King of penalty (kriii1_K) | C++98 | 72 ms | 2444 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
int n;
int i;
long long int p, tot;
cin>>p>>n;
vector<long long int> a(n+1,1000000001);
for(i=0;i<n;i++)
{
cin>>a[i];
}
sort(a.begin(),a.end()-1);
tot=0;
i=0;
p--;
while(p-a[i]>=0)
{
tot+=p;
p-=a[i];
i++;
}
cout<<i<<' '<<tot;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |