#include <bits/stdc++.h>
using namespace std;
#define all(a) a.begin(),a.end()
#define pb push_back
#define vt vector
#define endl '\n'
#define Y second
#define X first
typedef long long ll;
typedef long double ld;
const ll mod=1e9+7;
const ll INF=1e18;
const int inf=1e9;
const int N=2e6+505;
const int M=3e3+10;
const int dx[]={0,0,1,-1};
const int dy[]={1,-1,0,0};
/*From Benq:
stuff you should look for
* int overflow, array bounds
* special cases (n=1?)
* do smth instead of nothing and stay organized
* WRITE STUFF DOWN
* DON'T GET STUCK ON ONE APPROACH*/
int n,k;
ll a[N];
void solve(){
cin>>n>>k;
for(int i=1; i<=n; ++i){
cin>>a[i];
}sort(a+1,a+1+n);
if(a[1]==a[n]){
if(n%k/* && (n/k)*((a[1]+inf-1)/inf)>3000000*/){
cout<<-1<<endl;
return;
}cout<<(n/k)<<endl;
for(int i=1; i<=n; i+=k){
cout<<a[i]<<endl;
for(int j=i; j<i+k; ++j){
cout<<j<<' ';
}
}return;
}
}
int main(){
//srand(time(0));
//freopen("hotel.in","r",stdin);
//freopen("hotel.out","w",stdout);
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int tt=1,lolol=0;
// cin>>tt;
while(tt--) {
//cout<<"Case "<<++lolol<<": ";
solve();
}
}
Compilation message
nicegift.cpp: In function 'int main()':
nicegift.cpp:56:11: warning: unused variable 'lolol' [-Wunused-variable]
56 | int tt=1,lolol=0;
| ^~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
257 ms |
22040 KB |
n=1000000 |
2 |
Correct |
168 ms |
22296 KB |
n=666666 |
3 |
Correct |
113 ms |
12792 KB |
n=400000 |
4 |
Incorrect |
40 ms |
6348 KB |
Jury has the answer but participant has not |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |