#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define MOD 1000000007
#define INF 1000000
#define mp make_pair
#define ll long long
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef map<ll,ll> mii;
#define it(x) x::iterator
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define gcd __gcd
int main(){
int n, k;
cin>>n>>k;
int b[30] = {};
int a[n];
int mina = 30-(n+k-1);
FOR(i,0,n){ cin>>a[i]; b[a[i]]++; }
int tot = 0;
FOR(i,0,n) tot+=(1<<(a[i]));
int remainingbin = ((1<<30)-tot);
int remaining=-1;
while(remainingbin>0){
remaining++;
remainingbin/=2;
}
bool done = false;
if(!done && n>=2 && (a[0]<=a[1] && remaining<=a[0] || a[0]>=a[1] && remaining>=a[0])){
cout<<remaining<<" ";
done = true;
}
cout<<a[0]<<" ";
for(int i=1;i<n;i++){
if(!done && remaining>=a[i-1] && a[i]>=remaining || remaining<=a[i-1] && a[i]<=remaining){ cout<<remaining<<" "; done = true;}
cout<<a[i]<<" ";
}
cout<<endl;
}
Compilation message
zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:34:37: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
if(!done && n>=2 && (a[0]<=a[1] && remaining<=a[0] || a[0]>=a[1] && remaining>=a[0])){
~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
zalmoxis.cpp:40:39: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
if(!done && remaining>=a[i-1] && a[i]>=remaining || remaining<=a[i-1] && a[i]<=remaining){ cout<<remaining<<" "; done = true;}
~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
zalmoxis.cpp:23:9: warning: unused variable 'mina' [-Wunused-variable]
int mina = 30-(n+k-1);
^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
350 ms |
6264 KB |
Expected EOF |
2 |
Incorrect |
355 ms |
6304 KB |
Expected EOF |
3 |
Incorrect |
350 ms |
6392 KB |
Expected EOF |
4 |
Incorrect |
352 ms |
6424 KB |
Expected EOF |
5 |
Incorrect |
355 ms |
6320 KB |
Expected EOF |
6 |
Incorrect |
361 ms |
6244 KB |
Expected EOF |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
357 ms |
6420 KB |
Unexpected end of file - int32 expected |
2 |
Incorrect |
349 ms |
6264 KB |
Unexpected end of file - int32 expected |
3 |
Incorrect |
350 ms |
6392 KB |
Unexpected end of file - int32 expected |
4 |
Incorrect |
351 ms |
6268 KB |
Unexpected end of file - int32 expected |
5 |
Incorrect |
350 ms |
6400 KB |
Unexpected end of file - int32 expected |
6 |
Incorrect |
352 ms |
6392 KB |
Unexpected end of file - int32 expected |
7 |
Incorrect |
373 ms |
6384 KB |
Unexpected end of file - int32 expected |
8 |
Incorrect |
351 ms |
6508 KB |
Expected EOF |
9 |
Incorrect |
281 ms |
5112 KB |
Unexpected end of file - int32 expected |
10 |
Incorrect |
111 ms |
2168 KB |
Unexpected end of file - int32 expected |
11 |
Incorrect |
175 ms |
3320 KB |
Unexpected end of file - int32 expected |
12 |
Incorrect |
2 ms |
380 KB |
Unexpected end of file - int32 expected |
13 |
Incorrect |
2 ms |
376 KB |
Unexpected end of file - int32 expected |
14 |
Incorrect |
2 ms |
376 KB |
Unexpected end of file - int32 expected |