#include<algorithm>
#include<iostream>
using namespace std;
int main(){
int n;cin>>n;
vector<int>box(n,100);
int used=0;
while(n--){
int weight;cin>>weight;
auto it=find_if(box.begin(),box.end(),[&](int x){return x>=weight;});
if(*it==100)++used;
*it-=weight;
cout<<weight<<' '<<it-box.begin()+1<<endl;
}
cout<<used<<endl;
return 0;
}
pat2-09
最新推荐文章于 2024-03-04 15:29:48 发布