| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 642509 | Tenis0206 | Devil's Share (RMI19_devil) | C++11 | 455 ms | 5168 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int k;
vector<string> v;
queue<string> q;
int fr[15];
int get_max()
{
for(int c=9; c>=1; c--)
{
if(fr[c])
{
return c;
}
}
}
void solve_test()
{
cin>>k;
for(int i=1; i<=9; i++)
{
cin>>fr[i];
}
string rez;
for(int i=1; i<k; i++)
{
rez.push_back(get_max() + '0');
--fr[get_max()];
}
reverse(rez.begin(),rez.end());
int Max = get_max();
for(int i=1; i<=fr[Max]; i++)
{
string aux;
aux.push_back(Max + '0');
v.push_back(aux);
}
for(int c=1; c<Max; c++)
{
for(int i=1; i<=fr[c]; i++)
{
string aux;
aux.push_back(c + '0');
q.push(aux);
}
}
int poz = v.size() - 1;
while(!q.empty())
{
string s = q.front();
q.pop();
v[poz] += s;
--poz;
if(poz < 0)
{
poz = v.size() - 1;
}
else if(q.empty() || s!=q.front())
{
while(v.size()-1 > poz)
{
q.push(v.back());
v.pop_back();
}
}
}
for(int i=v.size()-1; i>=0; i--)
{
rez = v[i] + rez;
}
v.clear();
cout<<rez<<'\n';
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int t;
cin>>t;
for(int test=1; test<=t; test++)
{
solve_test();
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
