제출 #750121

#제출 시각아이디문제언어결과실행 시간메모리
750121Essa2006Zalmoxis (BOI18_zalmoxis)C++14
0 / 100
215 ms10316 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define endl '\n' #define FF first #define SS second #define all(a) a.begin(), a.end() #define mod (ll)(1000000007) int main(){ int n, k; cin>>n>>k; vector<int>A(n), B; for(int i=0;i<n;i++){ cin>>A[i]; } if(n==1){ return cout<<"29 29", 0; } B=A; int l=0, r=1, ind=-1, val; while(r<n){ while(A[r]==A[l]){ A[r]++; if(l) l--; } if(A[r]<A[l]) l=r++; else if(A[r]>A[l]){ ind=l, val=A[l]; break; } } if(ind==-1){ A=B; reverse(all(A)); l=0, r=1, ind=-1, val; while(r<n){ while(A[r]==A[l]){ A[r]++; if(l) l--; } if(A[r]<A[l]) l=r++; else if(A[r]>A[l]){ ind=l, val=A[l]; break; } } ind=n-1-ind; } for(int i=0;i<n;i++){ cout<<B[i]<<' '; if(i==ind) cout<<val<<' '; } }

컴파일 시 표준 에러 (stderr) 메시지

zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:37:30: warning: right operand of comma operator has no effect [-Wunused-value]
   37 |         l=0, r=1, ind=-1, val;
      |                              ^
zalmoxis.cpp:56:24: warning: 'val' may be used uninitialized in this function [-Wmaybe-uninitialized]
   56 |             cout<<val<<' ';
      |                        ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...