#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 = 1e18+10;
const int MAXN = 2e5+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: 'long long int' and 'long long unsigned int' [-Wsign-compare]
44 | for(int i=0; i<k-ans.size(); i++) cout << "0\n";
| ~^~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2830 ms |
65536 KB |
Time limit exceeded |
2 |
Execution timed out |
2983 ms |
65536 KB |
Time limit exceeded |
3 |
Execution timed out |
2938 ms |
65536 KB |
Time limit exceeded |
4 |
Execution timed out |
2863 ms |
65536 KB |
Time limit exceeded |
5 |
Execution timed out |
2802 ms |
65536 KB |
Time limit exceeded |
6 |
Execution timed out |
1238 ms |
65536 KB |
Time limit exceeded |
7 |
Execution timed out |
2866 ms |
65536 KB |
Time limit exceeded |
8 |
Execution timed out |
2799 ms |
65536 KB |
Time limit exceeded |
9 |
Incorrect |
39 ms |
9672 KB |
Output isn't correct |
10 |
Incorrect |
36 ms |
7008 KB |
Output isn't correct |
11 |
Execution timed out |
2815 ms |
65536 KB |
Time limit exceeded |
12 |
Execution timed out |
2801 ms |
65536 KB |
Time limit exceeded |
13 |
Runtime error |
36 ms |
11196 KB |
Execution killed with signal 11 |
14 |
Runtime error |
42 ms |
11940 KB |
Execution killed with signal 11 |
15 |
Runtime error |
38 ms |
11708 KB |
Execution killed with signal 11 |
16 |
Runtime error |
41 ms |
11452 KB |
Execution killed with signal 11 |
17 |
Runtime error |
54 ms |
12664 KB |
Execution killed with signal 11 |
18 |
Runtime error |
35 ms |
11704 KB |
Execution killed with signal 11 |
19 |
Runtime error |
36 ms |
11224 KB |
Execution killed with signal 11 |
20 |
Runtime error |
43 ms |
11452 KB |
Execution killed with signal 11 |