제출 #1058467

#제출 시각아이디문제언어결과실행 시간메모리
1058467user736482Bikeparking (EGOI24_bikeparking)C++17
0 / 100
29 ms11288 KiB
#include<bits/stdc++.h> using namespace std; long long a,b,c,t,n,x,y,m,q; vector<long long>v1,v2; stack<long long>s; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin>>n; long long res=0; for(long long i=0;i<n;i++){ cin>>a; v1.push_back(a); } for(long long i=0;i<n;i++){ cin>>a; v2.push_back(a); } long long pt1=n-1,pt2=n-1; pt2=n-1; while(pt2>=0){ res-=v2[pt2]; pt2--; } if(a) s.push(a); v2[n-1]=0; //cout<<res; //return 0; pt2=n-1; while(pt1>=0){ //cout<<pt1<<" "<<pt2<<" "; if(pt1>=pt2 || v1[pt1]==0){ pt1--; continue; } while(pt2-1>pt1){ pt2--; if(v2[pt2]) s.push(v2[pt2]); v2[pt2]=0; } if(s.empty()){ pt2--; if(v2[pt2]) s.push(v2[pt2]); res+=min(v1[pt2],v2[pt2]); continue;} v2[pt2]=s.top(); s.pop(); if(v2[pt2]>=v1[pt1]){ v2[pt2]-=v1[pt1]; res+=2*v1[pt1]; v1[pt1]=0; } else{ v1[pt1]-=v2[pt2]; res+=2*v2[pt2]; v2[pt2]=0; } if(v2[pt2]) s.push(v2[pt2]); v2[pt2]=0; } //return 0; //v2[pt2]-=min(v2[pt2],v1[pt2]); //cout<<res; cout<<res; return 0; }

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

Main.cpp: In function 'int main()':
Main.cpp:49:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   49 |         if(v2[pt2])
      |         ^~
Main.cpp:51:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   51 |                 res+=min(v1[pt2],v2[pt2]);
      |                 ^~~
#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...