Submission #745675

# Submission time Handle Problem Language Result Execution time Memory
745675 2023-05-21T00:17:32 Z 반딧불(#9962) Rainy Markets (CCO22_day1problem2) C++17
5 / 25
596 ms 82828 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int n;
ll arr[1000002], people[1000002], umb[1000002];
ll L[1000002], M[1000002], R[1000002];

int main(){
    scanf("%d", &n);
    for(int i=1; i<=n; i++) scanf("%lld", &arr[i]);
    for(int i=1; i<n; i++) scanf("%lld", &people[i]);
    for(int i=1; i<n; i++) scanf("%lld", &umb[i]);

    for(int i=1; i<n; i++){
        L[i] = min(people[i], arr[i]);
        arr[i] -= L[i], people[i] -= L[i];
        if(people[i] > arr[i+1]){
            printf("NO");
            exit(0);
        }
        arr[i+1] -= R[i] = people[i];
    }
    puts("YES\n0");
    for(int i=1; i<n; i++) printf("%lld %lld %lld\n", L[i], M[i], R[i]);
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
Main.cpp:13:34: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     for(int i=1; i<=n; i++) scanf("%lld", &arr[i]);
      |                             ~~~~~^~~~~~~~~~~~~~~~~
Main.cpp:14:33: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     for(int i=1; i<n; i++) scanf("%lld", &people[i]);
      |                            ~~~~~^~~~~~~~~~~~~~~~~~~~
Main.cpp:15:33: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     for(int i=1; i<n; i++) scanf("%lld", &umb[i]);
      |                            ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 252 ms 39328 KB Output is correct
5 Correct 303 ms 28860 KB Output is correct
6 Correct 277 ms 54988 KB Output is correct
7 Correct 306 ms 60892 KB Output is correct
8 Correct 3 ms 596 KB Output is correct
9 Correct 3 ms 572 KB Output is correct
10 Correct 440 ms 51792 KB Output is correct
11 Correct 442 ms 54988 KB Output is correct
12 Correct 546 ms 80808 KB Output is correct
13 Correct 502 ms 75948 KB Output is correct
14 Correct 298 ms 38660 KB Output is correct
15 Correct 563 ms 82636 KB Output is correct
16 Correct 596 ms 82760 KB Output is correct
17 Correct 564 ms 82712 KB Output is correct
18 Correct 534 ms 82828 KB Output is correct
19 Correct 567 ms 82720 KB Output is correct
20 Correct 546 ms 82688 KB Output is correct
21 Correct 551 ms 82428 KB Output is correct
22 Correct 553 ms 80144 KB Output is correct
23 Correct 576 ms 82728 KB Output is correct
24 Correct 535 ms 81812 KB Output is correct
25 Correct 306 ms 46116 KB Output is correct
26 Correct 319 ms 45372 KB Output is correct
27 Correct 545 ms 82716 KB Output is correct
28 Correct 554 ms 80784 KB Output is correct
29 Correct 589 ms 82624 KB Output is correct
30 Correct 577 ms 82652 KB Output is correct
31 Correct 573 ms 81372 KB Output is correct
32 Correct 577 ms 81664 KB Output is correct
33 Correct 311 ms 45432 KB Output is correct
34 Correct 322 ms 45752 KB Output is correct
35 Correct 309 ms 45224 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 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 252 ms 39328 KB Output is correct
5 Correct 303 ms 28860 KB Output is correct
6 Correct 277 ms 54988 KB Output is correct
7 Correct 306 ms 60892 KB Output is correct
8 Correct 3 ms 596 KB Output is correct
9 Correct 3 ms 572 KB Output is correct
10 Correct 440 ms 51792 KB Output is correct
11 Correct 442 ms 54988 KB Output is correct
12 Correct 546 ms 80808 KB Output is correct
13 Correct 502 ms 75948 KB Output is correct
14 Correct 298 ms 38660 KB Output is correct
15 Correct 563 ms 82636 KB Output is correct
16 Correct 596 ms 82760 KB Output is correct
17 Correct 564 ms 82712 KB Output is correct
18 Correct 534 ms 82828 KB Output is correct
19 Correct 567 ms 82720 KB Output is correct
20 Correct 546 ms 82688 KB Output is correct
21 Correct 551 ms 82428 KB Output is correct
22 Correct 553 ms 80144 KB Output is correct
23 Correct 576 ms 82728 KB Output is correct
24 Correct 535 ms 81812 KB Output is correct
25 Correct 306 ms 46116 KB Output is correct
26 Correct 319 ms 45372 KB Output is correct
27 Correct 545 ms 82716 KB Output is correct
28 Correct 554 ms 80784 KB Output is correct
29 Correct 589 ms 82624 KB Output is correct
30 Correct 577 ms 82652 KB Output is correct
31 Correct 573 ms 81372 KB Output is correct
32 Correct 577 ms 81664 KB Output is correct
33 Correct 311 ms 45432 KB Output is correct
34 Correct 322 ms 45752 KB Output is correct
35 Correct 309 ms 45224 KB Output is correct
36 Incorrect 1 ms 340 KB Output isn't correct
37 Halted 0 ms 0 KB -