Submission #710914

# Submission time Handle Problem Language Result Execution time Memory
710914 2023-03-16T04:56:01 Z penguin133 Rainy Markets (CCO22_day1problem2) C++17
5 / 25
535 ms 61144 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define pi pair<int, int>
#define pii pair<int, pi>
#define fi first
#define se second
#ifdef _WIN32
#define getchar_unlocked _getchar_nolock
#endif
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

int n, A[1000005], B[1000005], C[1000005];
pi ans[1000005];

void solve(){
	cin >> n;
	for(int i=1;i<=n;i++)cin >> A[i];
	for(int i=1;i<n;i++)cin >> B[i];
	for(int i=1;i<n;i++)cin >> C[i];
	for(int i=1;i<n;i++){
		ans[i].fi = min(A[i], B[i]);
		B[i] -= min(B[i], A[i]);
		if(B[i] > A[i+1]){
			cout << "NO\n";
			return;
		}
		ans[i].se = B[i];
		A[i+1] -= B[i];
	}
	cout << "YES\n 0\n";
	for(int i=1;i<n;i++)cout << ans[i].fi << ' ' << 0 << ' ' << ans[i].se << '\n';
}

main(){
	ios::sync_with_stdio(0);cin.tie(0);
	int tc = 1;
	//cin >> tc;
	for(int tc1=1;tc1<=tc;tc1++){
		// cout << "Case #" << tc1 << ": ";
		solve();
	}
}

Compilation message

Main.cpp:36:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   36 | main(){
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 184 ms 23764 KB Output is correct
5 Correct 236 ms 23784 KB Output is correct
6 Correct 207 ms 39352 KB Output is correct
7 Correct 246 ms 39428 KB Output is correct
8 Correct 2 ms 596 KB Output is correct
9 Correct 2 ms 596 KB Output is correct
10 Correct 352 ms 45480 KB Output is correct
11 Correct 336 ms 46996 KB Output is correct
12 Correct 463 ms 59088 KB Output is correct
13 Correct 512 ms 53524 KB Output is correct
14 Correct 194 ms 23760 KB Output is correct
15 Correct 535 ms 61072 KB Output is correct
16 Correct 445 ms 61096 KB Output is correct
17 Correct 448 ms 61064 KB Output is correct
18 Correct 471 ms 61108 KB Output is correct
19 Correct 486 ms 61068 KB Output is correct
20 Correct 476 ms 61100 KB Output is correct
21 Correct 434 ms 60772 KB Output is correct
22 Correct 480 ms 58340 KB Output is correct
23 Correct 462 ms 61144 KB Output is correct
24 Correct 514 ms 60228 KB Output is correct
25 Correct 238 ms 24464 KB Output is correct
26 Correct 233 ms 23748 KB Output is correct
27 Correct 464 ms 61084 KB Output is correct
28 Correct 442 ms 59132 KB Output is correct
29 Correct 437 ms 61132 KB Output is correct
30 Correct 514 ms 61032 KB Output is correct
31 Correct 442 ms 59892 KB Output is correct
32 Correct 447 ms 61064 KB Output is correct
33 Correct 226 ms 23780 KB Output is correct
34 Correct 217 ms 24268 KB Output is correct
35 Correct 217 ms 23756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 184 ms 23764 KB Output is correct
5 Correct 236 ms 23784 KB Output is correct
6 Correct 207 ms 39352 KB Output is correct
7 Correct 246 ms 39428 KB Output is correct
8 Correct 2 ms 596 KB Output is correct
9 Correct 2 ms 596 KB Output is correct
10 Correct 352 ms 45480 KB Output is correct
11 Correct 336 ms 46996 KB Output is correct
12 Correct 463 ms 59088 KB Output is correct
13 Correct 512 ms 53524 KB Output is correct
14 Correct 194 ms 23760 KB Output is correct
15 Correct 535 ms 61072 KB Output is correct
16 Correct 445 ms 61096 KB Output is correct
17 Correct 448 ms 61064 KB Output is correct
18 Correct 471 ms 61108 KB Output is correct
19 Correct 486 ms 61068 KB Output is correct
20 Correct 476 ms 61100 KB Output is correct
21 Correct 434 ms 60772 KB Output is correct
22 Correct 480 ms 58340 KB Output is correct
23 Correct 462 ms 61144 KB Output is correct
24 Correct 514 ms 60228 KB Output is correct
25 Correct 238 ms 24464 KB Output is correct
26 Correct 233 ms 23748 KB Output is correct
27 Correct 464 ms 61084 KB Output is correct
28 Correct 442 ms 59132 KB Output is correct
29 Correct 437 ms 61132 KB Output is correct
30 Correct 514 ms 61032 KB Output is correct
31 Correct 442 ms 59892 KB Output is correct
32 Correct 447 ms 61064 KB Output is correct
33 Correct 226 ms 23780 KB Output is correct
34 Correct 217 ms 24268 KB Output is correct
35 Correct 217 ms 23756 KB Output is correct
36 Incorrect 1 ms 340 KB Output isn't correct
37 Halted 0 ms 0 KB -