Submission #106059

#TimeUsernameProblemLanguageResultExecution timeMemory
106059fadi57Karte (COCI18_karte)C++14
120 / 120
268 ms13892 KiB
#include <bits/stdc++.h> using namespace std; #define clr(i, j) memset(i, j, sizeof(i)) #define pb push_back typedef long long ll; //-*-*-*-*-*-*-*-*- #define mod 1000000007 //ll mn[9999];ll mx[9999];ll arr[99999]; map<pair<ll,ll>,ll>mp; map<ll,ll>m; ll vis[999999];const int inf = 4e8; vector<ll>v;vector<ll>f; //ll inf=9999999; int main() {//cout<<8; ll n,k;cin>>n>>k;ll x; for(int i=0;i<n;i++){ cin>>x;//if(x>k){l.push_back(x);f++;}else{v.push_back(x);} v.push_back(x); } ll ans[n]; //ll g=upper_bound(v.begin(),v.end(),f)-v.begin(); sort(v.begin(),v.end());ll t=n-1;ll c=0; for(int i=0;i<n-k;i++){ans[i]=v[i];}ll j=n-k; for(int i=n-1;i>=n-k;i--){ans[j]=v[i];j++;} //ll v=0; for(int i=n-1;i>=0;i--){ if(ans[i]>c){c++;} }if(c!=k){cout<<-1;return 0;}for(int i=0;i<n;i++){ cout<<ans[i]<<" "; } }

Compilation message (stderr)

karte.cpp: In function 'int main()':
karte.cpp:32:36: warning: unused variable 't' [-Wunused-variable]
         sort(v.begin(),v.end());ll t=n-1;ll c=0;
                                    ^
#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...
#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...