제출 #1365926

#제출 시각아이디문제언어결과실행 시간메모리
1365926kmath628Exam (eJOI20_exam)C++20
12 / 100
10 ms1196 KiB
#include <bits/stdc++.h>
using namespace std;
int a[100009],b[100009],d[100009];
int main(){
    int n,i,j,ans=0,last=0;
    bool flag=0;
    scanf("%d",&n);
    for(i=1;i<=n;i++) scanf("%d",&a[i]);
    for(i=1;i<=n;i++) scanf("%d",&b[i]);
    for(i=1;i<=n;i++){
        if(a[i]>b[i]) last=i,flag=0;
        else if(flag) last=i,ans++;
        else if(a[i]==b[i]){
            ans+=i-last;
            flag=1;
            last=i;
        }
    }
    printf("%d\n",ans);
    return 0;
}

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

exam.cpp: In function 'int main()':
exam.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
exam.cpp:8:28: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     for(i=1;i<=n;i++) scanf("%d",&a[i]);
      |                       ~~~~~^~~~~~~~~~~~
exam.cpp:9:28: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     for(i=1;i<=n;i++) scanf("%d",&b[i]);
      |                       ~~~~~^~~~~~~~~~~~
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…