제출 #437590

#제출 시각아이디문제언어결과실행 시간메모리
437590shahriarkhanFancy Fence (CEOI20_fancyfence)C++14
12 / 100
2 ms292 KiB
#include<bits/stdc++.h> using namespace std ; int main() { int n ; scanf("%d",&n) ; int h[n+1] , w[n+1] , ans = 0 ; for(int i = 1 ; i <= n ; ++i) scanf("%d",&h[i]) ; for(int i = 1 ; i <= n ; ++i) scanf("%d",&w[i]) ; for(int i = 1 ; i <= n ; ++i) { int mn = h[i] ; for(int j = i ; j >= 1 ; --j) { mn = min(mn,h[j]) ; ans += ((mn*(mn+1))/2) ; } } printf("%d\n",ans) ; return 0 ; }

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

fancyfence.cpp: In function 'int main()':
fancyfence.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     scanf("%d",&n) ;
      |     ~~~~~^~~~~~~~~
fancyfence.cpp:9:40: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     for(int i = 1 ; i <= n ; ++i) scanf("%d",&h[i]) ;
      |                                   ~~~~~^~~~~~~~~~~~
fancyfence.cpp:10:40: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     for(int i = 1 ; i <= n ; ++i) scanf("%d",&w[i]) ;
      |                                   ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...