# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
89515 | RAkhshon | Gift (IZhO18_nicegift) | C++17 | 2029 ms | 79884 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ll long long
#define fr first
#define se second
using namespace std;
set< pair< ll, ll > > st;
vector< ll > ans;
int main(){
ll n, k;
cin>>n>>k;
for( ll i =1 ; i <= n ; i ++ ){
ll x;
cin>>x;
st.insert({x,i});
}
/***
std::pair<ll,ll> x;
x=*st.rbegin();
st.erase(x);
***/
ans.push_back(-1);
while( st.size()>k-1 ){
ll t = k;
ans.push_back(1);
while( t > 0 ){
std::pair< ll , ll > x;
x=*st.rbegin();
st.erase(*st.rbegin());
if( x.fr-1 != 0 ) st.insert({x.fr-1,x.se});
ans.push_back(x.se);
t--;
}
///cout<<st.size()<<endl;
}
if( st.size() < k && st.size()!=0 ){
cout<<-1;
return 0;
}
cout<<(ans.size()-1)/(k+1)<<endl;
for( ll i = 1; i < ans.size(); i ++ ){
cout<<ans[i]<<' ';
if( (i)%(k+1)==0 ) cout<<endl;
}
}
컴파일 시 표준 에러 (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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |