#include <bits/stdc++.h> using namespace std; int main(){ int q,x; cin>>q>>x; int t=0; int a[400005]; while(q--){ int m; cin>>m; a[m%x]++; while(a[t%x]){ a[t%x]--; t++; } cout<<t<<endl; } return 0; }
注册一个 oj 通用账户,您就可以在我们提供的所有在线评测服务上提交代码、参与讨论。
使用您的 oj 通用账户