3 条题解

  • 0
    @ 2024-1-29 17:13:01
    #include <bits/stdc++.h>
    using namespace std;
    
    typedef long long ll;
    const int N = 4e5 + 10;
    int a[N];
    int n, x, t;
    
    int main() {
    	cin >> n >> x;
    	while (n--) {
    		int m;
    		cin >> m;
    		a[m % x]++;
    		while (a[t % x]) {
    			a[t % x]--;
    			t++;
    		}
    		cout << t << "\n";
    	}
    	
    	return 0;
    }
    

    信息

    ID
    498
    时间
    2000ms
    内存
    256MiB
    难度
    8
    标签
    (无)
    递交数
    16
    已通过
    7
    上传者