답안 #745674

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
745674 2023-05-21T00:16:06 Z 반딧불(#9962) Rainy Markets (CCO22_day1problem2) C++17
0 / 25
1 ms 340 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

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

int main(){
    scanf("%d", &n);
    for(int i=1; i<=n; i++) scanf("%d", &arr[i]);
    for(int i=1; i<n; i++) scanf("%d", &people[i]);
    for(int i=1; i<n; i++) scanf("%d", &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");
    for(int i=1; i<n; i++) printf("%d %d %d\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("%d", &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("%d", &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("%d", &umb[i]);
      |                            ~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Incorrect 0 ms 312 KB Unexpected end of file - int64 expected
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Incorrect 0 ms 312 KB Unexpected end of file - int64 expected
3 Halted 0 ms 0 KB -