제출 #1091091

#제출 시각아이디문제언어결과실행 시간메모리
1091091PieArmyEditor (BOI15_edi)C++17
100 / 100
124 ms28004 KiB
typedef long long ll; ll pie(ll army){return (1ll<<army);} #include <bits/stdc++.h> #define fr first #define sc second #define pb push_back #define endl '\n' #define mid ((left+right)>>1) const ll inf=2000000000000000005; const int sonsuz=2000000005; using namespace std; ll fpow(ll x,ll y,ll m=0){if(y<0){cout<<"powError";return -1;}if(m)x%=m;ll res=1;while(y>0){if(y&1)res*=x;x*=x;if(m){x%=m;res%=m;}y>>=1;}return res;} int n; int arr[300001]; int par[300001][19]; void code(){ cin>>n; for(int i=1;i<=n;i++){ cin>>arr[i]; if(arr[i]<0){ int root=i-1; if(arr[root]<=arr[i]){ for(int j=19-1;j>=0;j--){ if(arr[par[root][j]]<=arr[i]){ root=par[root][j]; } } root=par[root][0]; } root--; if(arr[root]<=arr[i]){ for(int j=19-1;j>=0;j--){ if(arr[par[root][j]]<=arr[i]){ root=par[root][j]; } } root=par[root][0]; } par[i][0]=root; for(int j=1;j<19;j++){ par[i][j]=par[par[i][j-1]][j-1]; } root=i; for(int j=19-1;j>=0;j--){ if(arr[par[root][j]]<0){ root=par[root][j]; } } root=par[root][0]; cout<<arr[root]<<endl; } else{ cout<<arr[i]<<endl; } } } int main(){ ios_base::sync_with_stdio(false);cin.tie(NULL); bool usaco=0;if(usaco){freopen(".in","r",stdin);freopen(".out","w",stdout);} int t=1; if(!t)cin>>t; while(t--){code();cout<<endl;} return 0; }

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

edi.cpp: In function 'int main()':
edi.cpp:62:32: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   62 |  bool usaco=0;if(usaco){freopen(".in","r",stdin);freopen(".out","w",stdout);}
      |                         ~~~~~~~^~~~~~~~~~~~~~~~~
edi.cpp:62:57: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   62 |  bool usaco=0;if(usaco){freopen(".in","r",stdin);freopen(".out","w",stdout);}
      |                                                  ~~~~~~~^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...