제출 #127140

#제출 시각아이디문제언어결과실행 시간메모리
127140_SamirKarte (COCI18_karte)C++17
120 / 120
127 ms7876 KiB
#include<queue> #include <cmath> #include <complex> #include<map> #include <string> #include<iostream> #include<bits/stdc++.h> #define pi 3.141592654 #define forr(i,a,b) for(int i=a;i<=b;i++) #define F first #define S second #define input ios_base::sync_with_stdio(0);cin.tie(0); /* #define X real() #define Y imag() #define angle(a) (atan2((a).imag(), (a).real())) #define vec(a,b) ((b)-(a)) #define same(p1,p2) (dp(vec(p1,p2),vec(p1,p2)) < EPS) #define dp(a,b) ( (conj(a)*(b)).real() ) // a*b cos(T), if zero -> prep ,cos #define cp(a,b) ( (conj(a)*(b)).imag() ) // a*b sin(T), if zero -> parllel , sin #define length(a) (hypot((a).imag(), (a).real())) #define normalize(a) (a)/length(a) //#define polar(r,ang) ((r)*exp(point(0,ang))) ==> Already added in c++11 #define rotateO(p,ang) ((p)*exp(point(0,ang))) #define rotateA(p,ang,about) (rotateO(vec(about,p),ang)+about) #define reflectO(v,m) (conj((v)/(m))*(m)) */ using namespace std; typedef pair<double,double>pdd; typedef long long ll; typedef pair<ll, ll>pii; typedef complex<double> point; //template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); } //typedef bitset<30> mask; //int x[8]={1,0,0,-1,-1,-1,1,1}; //int y[8]={0,1,-1,0,-1,1,-1,1}; //#define var(x) ((x)<<1) //#define nvar(x) ((x)^1) const int N=100000,M=100000; const double EPS= 1e-8; int n,k,a[500006]; int main() { //cout<<Pow((ll)1000000,(ll)110); //freopen("262144.in","r",stdin); //freopen("262144.out","w",stdout); // char input[15]; // scanf("%s", &input); array of char // gets(c+1); array of char //printf("%s, ",name[k[i]].c_str()); printf of string //priority_queue<ll,vector<ll>,greater<ll>>y; input; cin>>n>>k; forr(i,1,n)cin>>a[i]; sort(a+1,a+1+n); for(int i=1,j=n;i<=k;i++,j--) { if(a[j]<=k-i) { cout<<"-1"; return 0; } } for(int i=1;i<=n-k;i++) { if(a[i]>k) { cout<<"-1"; return 0; } } for(int i=1;i<=n-k;i++)cout<<a[i]<<" "; for(int i=1,j=n;i<=k;i++,j--)cout<<a[j]<<" "; return 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...