제출 #1219470

#제출 시각아이디문제언어결과실행 시간메모리
1219470sleepntsheepFlooding Wall (BOI24_wall)C11
8 / 100
139 ms396 KiB
#include <stdio.h> #define N 22 int n, a[N], b[N], v[N], pmx[N], smx[N]; long long answer; int main() { scanf("%d", &n); for (int i = 0; i < n; ++i) scanf("%d", a + i); for (int i = 0; i < n; ++i) scanf("%d", b + i); for (int m = 0; m < (1 << n); ++m) { for (int i = 0; i < n; ++i) v[i] = (m >> i) & 1 ? a[i] : b[i]; pmx[1] = v[0]; for (int i = 1; i < n - 1; ++i) pmx[i + 1] = pmx[i] > v[i] ? pmx[i] : v[i]; smx[n - 2] = v[n - 1]; for (int i = n - 2; i >= 1; --i) smx[i - 1] = smx[i] > v[i] ? smx[i] : v[i]; for (int i = 1; i < n - 1; ++i) { int y = pmx[i] < smx[i] ? pmx[i] : smx[i]; if (y > v[i]) answer = (answer + y - v[i]) % 1000000007; } } printf("%lld\n", answer); return 0; }

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

Main.c: In function 'main':
Main.c:8:9: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |         scanf("%d", &n);
      |         ^~~~~~~~~~~~~~~
Main.c:9:37: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |         for (int i = 0; i < n; ++i) scanf("%d", a + i);
      |                                     ^~~~~~~~~~~~~~~~~~
Main.c:10:37: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |         for (int i = 0; i < n; ++i) scanf("%d", b + 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...