#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
//#define int long long
#define lf (id<<1)
#define rg ((id<<1)|1)
#define md ((l+r)>>1)
using namespace std;
typedef pair<int,int> pii;
typedef pair<pii,int> ipii;
const int INF = 1e9+10;
const int MAXN = 1e6+10;
int a[MAXN];
vector <pii> vec;
vector <vector<int>> ans;
int n, m, k;
signed main() {
cin >> k >> m >> n;
for(int i=1; i<=n; i++){
cin >> a[i]; vec.pb({a[i], i});
}
sort(vec.begin(), vec.end());
int mn = -1, cnt = 1;
for(int i=0; i<n; i+=m){
vector <int> te;
for(int j=0; j<m && i+j<n; j++){
mn = max(mn, cnt-vec[i+j].fi+1);
te.pb(vec[i+j].se);
}
ans.pb(te);
cnt++;
}
cout << mn << '\n';
for(auto vec : ans){
for(auto in : vec){
cout << in << ' ';
}
cout << "0\n";
}
for(int i=0; i<k-ans.size(); i++) cout << "0\n";
}
Compilation message
jobs.cpp: In function 'int main()':
jobs.cpp:44:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
44 | for(int i=0; i<k-ans.size(); i++) cout << "0\n";
| ~^~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2898 ms |
65536 KB |
Time limit exceeded |
2 |
Execution timed out |
2831 ms |
65536 KB |
Time limit exceeded |
3 |
Execution timed out |
2769 ms |
65536 KB |
Time limit exceeded |
4 |
Execution timed out |
2777 ms |
65536 KB |
Time limit exceeded |
5 |
Execution timed out |
2794 ms |
65536 KB |
Time limit exceeded |
6 |
Execution timed out |
2836 ms |
65536 KB |
Time limit exceeded |
7 |
Execution timed out |
2799 ms |
65536 KB |
Time limit exceeded |
8 |
Execution timed out |
2820 ms |
65536 KB |
Time limit exceeded |
9 |
Incorrect |
43 ms |
9656 KB |
Output isn't correct |
10 |
Incorrect |
36 ms |
6768 KB |
Output isn't correct |
11 |
Execution timed out |
2992 ms |
65536 KB |
Time limit exceeded |
12 |
Execution timed out |
3033 ms |
65536 KB |
Time limit exceeded |
13 |
Execution timed out |
2931 ms |
65536 KB |
Time limit exceeded |
14 |
Incorrect |
140 ms |
10676 KB |
Output isn't correct |
15 |
Runtime error |
601 ms |
65540 KB |
Execution killed with signal 9 |
16 |
Execution timed out |
2981 ms |
65536 KB |
Time limit exceeded |
17 |
Incorrect |
253 ms |
20004 KB |
Output isn't correct |
18 |
Execution timed out |
2820 ms |
65536 KB |
Time limit exceeded |
19 |
Execution timed out |
2851 ms |
65536 KB |
Time limit exceeded |
20 |
Incorrect |
243 ms |
19688 KB |
Output isn't correct |