Submission #881301

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
8813012023-12-01 04:20:56dimashhhGift (IZhO18_nicegift)C++17
7 / 100
569 ms192672 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e6 + 1;
#define int long long
int n,k;
ll a[N];
set<pair<ll,ll>> st;
vector<pair<vector<int>,int>> res(N * 3);
void test(){
cin >> n >> k;
for(int i = 1;i <= n;i++){
cin >> a[i];
st.insert({a[i],i});
}
int it = 1;
while(!st.empty()){
if((int)(it - 1) * k > 3e6||st.size() < k){
cout << -1 << '\n';
return;
}
vector<int> f;
int oo;
for(int i = 1;i <= k;i++){
auto [x,y] = *st.rbegin();
st.erase({x,y});
oo = x;
f.push_back(y);
}
res[it] = {f,oo};
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

nicegift.cpp: In function 'void test()':
nicegift.cpp:18:47: warning: comparison of integer expressions of different signedness: 'std::set<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   18 |         if((int)(it - 1) * k > 3e6||st.size() < k){
      |                                     ~~~~~~~~~~^~~
nicegift.cpp: At global scope:
nicegift.cpp:47:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   47 | main(){
      | ^~~~
nicegift.cpp: In function 'void test()':
nicegift.cpp:33:18: warning: 'oo' may be used uninitialized in this function [-Wmaybe-uninitialized]
   33 |             a[j] -= oo;
      |             ~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...