답안 #711129

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
711129 2023-03-16T08:52:40 Z ld_minh4354 Rainy Markets (CCO22_day1problem2) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;

#define int long long
#define fi first
#define se second
#define pb push_back
#define debug(x) cout<<#x<<": "<<x<<"\n"

int n,i,x,y,b[1000005],p[1000005],u[1000005];
pair<int,int> ans[1000005];

signed main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//	freopen("input.000","r",stdin);
//	freopen("output.000","w",stdout);
//	srand((unsigned)time(NULL));
//	rand()
	
	cin>>n;
	for (i=1;i<n+1;i++) cin>>b[i];
	for (i=1;i<n;i++) cin>>p[i];
	for (i=1;i<n;i++) cin>>u[i];
	
	for (i=1;i<n;i++)
	{
		ans[i].fi=min(b[i],p[i]);
		ans[i].se=p[i]-ans[i].fi;
		
		if (ans[i].se>b[i+1])
		{
			cout<<"NO";return 0;
		}
		
		b[i+1] -= ans[i].se;
	}
	
	cout<<"YES\n0"
	for (i=1;i<n;i++) cout<<"\n"<<ans[i].fi<<" 0 "<<ans[i].se;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:39:16: error: expected ';' before 'for'
   39 |  cout<<"YES\n0"
      |                ^
      |                ;
   40 |  for (i=1;i<n;i++) cout<<"\n"<<ans[i].fi<<" 0 "<<ans[i].se;
      |  ~~~            
Main.cpp:40:12: warning: statement has no effect [-Wunused-value]
   40 |  for (i=1;i<n;i++) cout<<"\n"<<ans[i].fi<<" 0 "<<ans[i].se;
      |           ~^~
Main.cpp:40:18: error: expected ';' before ')' token
   40 |  for (i=1;i<n;i++) cout<<"\n"<<ans[i].fi<<" 0 "<<ans[i].se;
      |                  ^
      |                  ;