| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 4058 | shinhj88 | King of penalty (kriii1_K) | C++98 | 0 ms | 1236 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
long long int P,N;
vector<long long int> data;
void input()
{
scanf("%lld%lld",&P,&N);
data.resize(N+1);
for(int i=0;i<N;i++)
{
scanf("%lld",&data[i]);
}
data[N]=100000001;
sort(data.begin(),data.end());
}
void process()
{
long long int Sum=0,ans=0,i;
for(i=0;i<N;i++)
{
if(Sum+data[i]>=P)
{
break;
}
Sum+=data[i];
}
ans=(P-1-Sum)+data[i-1];
for(int j=i-2;j>=0;j--)
{
ans+=(ans+data[j]);
}
printf("%d %lld",i,ans);
return;
}
int main()
{
input();
process();
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
