제출 #1365923

#제출 시각아이디문제언어결과실행 시간메모리
1365923kmath628Exam (eJOI20_exam)C++20
0 / 100
1094 ms1136 KiB
#include <bits/stdc++.h>
using namespace std;
int a[100009],b[100009],d[100009];
int main(){
    int n,i,j;
    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++){
        unordered_map<int,int> c;
        int mx=0;
        for(j=i;j>=1;j--){
            c[b[j]]++;
            mx=max(mx,a[j]);
            d[i]=max(d[i],d[j-1]+c[mx]);
        }
    }
    printf("%d\n",d[n]);
    return 0;
}

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

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